Merge pull request #7 from dikstub-rssa/feat/crud

Feat/crud
This commit is contained in:
Munawwirul Jamal
2025-08-29 11:08:39 +07:00
committed by GitHub
407 changed files with 33449 additions and 254 deletions
+7 -2
View File
@@ -47,7 +47,12 @@ corsCfg:
allowedMethod:
satuSehatCfg:
host: localhsot:8200
host: localhost:8200
bpjsCfg:
host: localhsot:8200
host: localhost:8200
corsCfg:
allowedOrigins:
- http://example.com
allowedMethod:
-22
View File
@@ -1,22 +0,0 @@
data "external_schema" "gorm" {
program = [
"go",
"run",
"-mod=mod",
".",
]
}
env "gorm" {
src = data.external_schema.gorm.url
dev = "postgres://moko:password@localhost:5432/simrs_vx3?sslmode=disable"
migration {
dir = "file://migrations"
}
url = "postgres://moko:password@localhost:5432/simrs_vx1?sslmode=disable"
format {
migrate {
diff = "{{ sql . \" \" }}"
}
}
}
+545
View File
@@ -0,0 +1,545 @@
-- Create "DiagnoseSrc" table
CREATE TABLE "public"."DiagnoseSrc" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(10) NULL,
"Name" character varying(2048) NULL,
"IndName" character varying(2048) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_DiagnoseSrc_Code" UNIQUE ("Code")
);
-- Create "PharmacyCompany" table
CREATE TABLE "public"."PharmacyCompany" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(20) NULL,
"Name" character varying(100) NULL,
"Regency_Code" character varying(4) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_PharmacyCompany_Code" UNIQUE ("Code")
);
-- Create "McuSrc" table
CREATE TABLE "public"."McuSrc" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(20) NULL,
"Name" character varying(50) NULL,
"CheckupCategory_Code" character varying(20) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_McuSrc_Code" UNIQUE ("Code")
);
-- Create "ItemGroup" table
CREATE TABLE "public"."ItemGroup" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(50) NULL,
"Name" character varying(100) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_ItemGroup_Code" UNIQUE ("Code")
);
-- Create "McuSrcCategory" table
CREATE TABLE "public"."McuSrcCategory" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(20) NULL,
"Name" character varying(50) NULL,
"Scope_Code" character varying(10) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_McuSrcCategory_Code" UNIQUE ("Code")
);
-- Create "Counter" table
CREATE TABLE "public"."Counter" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(10) NULL,
"Name" character varying(30) NULL,
"Number" smallint NULL,
"Parent_Id" integer NULL,
"Type_Code" text NULL,
"Queue_Code" character varying(5) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Counter_Code" UNIQUE ("Code")
);
-- Create "User" table
CREATE TABLE "public"."User" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Name" character varying(25) NOT NULL,
"Password" character varying(255) NOT NULL,
"Status_Code" character varying(10) NOT NULL,
"FailedLoginCount" smallint NULL,
"LoginAttemptCount" bigint NULL,
"LastSuccessLogin" timestamptz NULL,
"LastAllowdLogin" timestamptz NULL,
PRIMARY KEY ("Id")
);
-- Create "Uom" table
CREATE TABLE "public"."Uom" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(10) NULL,
"Name" character varying(50) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Uom_Code" UNIQUE ("Code")
);
-- Create "Item" table
CREATE TABLE "public"."Item" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(50) NULL,
"Name" character varying(100) NULL,
"ItemGroup_Code" character varying(10) NULL,
"Uom_Code" character varying(10) NULL,
"Infra_Id" integer NULL,
"Stock" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Item_Code" UNIQUE ("Code"),
CONSTRAINT "fk_Item_ItemGroup" FOREIGN KEY ("ItemGroup_Code") REFERENCES "public"."ItemGroup" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Item_Uom" FOREIGN KEY ("Uom_Code") REFERENCES "public"."Uom" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Device" table
CREATE TABLE "public"."Device" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(10) NULL,
"Name" character varying(50) NULL,
"Uom_Code" character varying(10) NULL,
"Item_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Device_Code" UNIQUE ("Code"),
CONSTRAINT "fk_Device_Item" FOREIGN KEY ("Item_Id") REFERENCES "public"."Item" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Device_Uom" FOREIGN KEY ("Uom_Code") REFERENCES "public"."Uom" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Province" table
CREATE TABLE "public"."Province" (
"Id" smallserial NOT NULL,
"Code" character varying(2) NULL,
"Name" character varying(50) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Province_Code" UNIQUE ("Code")
);
-- Create "Regency" table
CREATE TABLE "public"."Regency" (
"Id" serial NOT NULL,
"Province_Code" character varying(2) NULL,
"Code" character varying(4) NULL,
"Name" character varying(50) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Regency_Code" UNIQUE ("Code"),
CONSTRAINT "fk_Province_Regencies" FOREIGN KEY ("Province_Code") REFERENCES "public"."Province" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "District" table
CREATE TABLE "public"."District" (
"Id" bigserial NOT NULL,
"Regency_Code" character varying(4) NULL,
"Code" character varying(6) NULL,
"Name" character varying(50) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_District_Code" UNIQUE ("Code"),
CONSTRAINT "fk_Regency_Districts" FOREIGN KEY ("Regency_Code") REFERENCES "public"."Regency" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Division" table
CREATE TABLE "public"."Division" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(10) NULL,
"Name" character varying(50) NULL,
"Parent_Id" smallint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Division_Code" UNIQUE ("Code")
);
-- Create "DivisionPosition" table
CREATE TABLE "public"."DivisionPosition" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Division_Id" integer NULL,
"Code" character varying(10) NULL,
"Name" character varying(50) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_DivisionPosition_Code" UNIQUE ("Code"),
CONSTRAINT "fk_DivisionPosition_Division" FOREIGN KEY ("Division_Id") REFERENCES "public"."Division" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Employee" table
CREATE TABLE "public"."Employee" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"User_Id" bigint NULL,
"Person_Id" bigint NULL,
"Position_Code" character varying(20) NOT NULL,
"Division_Code" character varying(10) NULL,
"Number" character varying(20) NULL,
"Status_Code" character varying(10) NOT NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Employee_Division" FOREIGN KEY ("Division_Code") REFERENCES "public"."Division" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Installation" table
CREATE TABLE "public"."Installation" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(10) NULL,
"Name" character varying(50) NULL,
"EncounterClass_Code" character varying(10) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Installation_Code" UNIQUE ("Code")
);
-- Create "Unit" table
CREATE TABLE "public"."Unit" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Installation_Id" integer NULL,
"Code" character varying(10) NULL,
"Name" character varying(50) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Unit_Code" UNIQUE ("Code"),
CONSTRAINT "fk_Unit_Installation" FOREIGN KEY ("Installation_Id") REFERENCES "public"."Installation" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Doctor" table
CREATE TABLE "public"."Doctor" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Employee_Id" bigint NULL,
"IHS_Number" character varying(20) NULL,
"SIP_Number" character varying(20) NULL,
"Unit_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Doctor_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Doctor_Unit" FOREIGN KEY ("Unit_Id") REFERENCES "public"."Unit" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "DoctorFee" table
CREATE TABLE "public"."DoctorFee" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Doctor_Id" bigint NULL,
"FeeType_Code" character varying(11) NULL,
"Price" numeric NULL,
"Item_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_DoctorFee_Doctor" FOREIGN KEY ("Doctor_Id") REFERENCES "public"."Doctor" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_DoctorFee_Item" FOREIGN KEY ("Item_Id") REFERENCES "public"."Item" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "InfraGroup" table
CREATE TABLE "public"."InfraGroup" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(10) NULL,
"Name" character varying(50) NULL,
"Level" smallint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_InfraGroup_Code" UNIQUE ("Code")
);
-- Create "Infra" table
CREATE TABLE "public"."Infra" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(10) NULL,
"Name" character varying(50) NULL,
"InfraGroup_Code" character varying(10) NULL,
"Parent_Id" smallint NULL,
"Item_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Infra_Code" UNIQUE ("Code"),
CONSTRAINT "fk_Infra_InfraGroup" FOREIGN KEY ("InfraGroup_Code") REFERENCES "public"."InfraGroup" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Infra_Item" FOREIGN KEY ("Item_Id") REFERENCES "public"."Item" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "InsuranceCompany" table
CREATE TABLE "public"."InsuranceCompany" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(20) NULL,
"Name" character varying(50) NULL,
"Regency_Code" character varying(4) NULL,
"Address" character varying(100) NULL,
"PhoneNumber" character varying(20) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_InsuranceCompany_Code" UNIQUE ("Code"),
CONSTRAINT "fk_InsuranceCompany_Regency" FOREIGN KEY ("Regency_Code") REFERENCES "public"."Regency" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "ItemPrice" table
CREATE TABLE "public"."ItemPrice" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Item_Id" bigint NULL,
"Price" numeric NULL,
"InsuranceCompany_Code" character varying(20) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_ItemPrice_InsuranceCompany" FOREIGN KEY ("InsuranceCompany_Code") REFERENCES "public"."InsuranceCompany" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_ItemPrice_Item" FOREIGN KEY ("Item_Id") REFERENCES "public"."Item" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Material" table
CREATE TABLE "public"."Material" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(10) NULL,
"Name" character varying(50) NULL,
"Uom_Code" character varying(10) NULL,
"Stock" bigint NULL,
"Item_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Material_Code" UNIQUE ("Code"),
CONSTRAINT "fk_Material_Item" FOREIGN KEY ("Item_Id") REFERENCES "public"."Item" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Material_Uom" FOREIGN KEY ("Uom_Code") REFERENCES "public"."Uom" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "MedicalActionSrc" table
CREATE TABLE "public"."MedicalActionSrc" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(20) NULL,
"Name" character varying(50) NULL,
"Item_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_MedicalActionSrc_Code" UNIQUE ("Code"),
CONSTRAINT "fk_MedicalActionSrc_Item" FOREIGN KEY ("Item_Id") REFERENCES "public"."Item" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "ProcedureSrc" table
CREATE TABLE "public"."ProcedureSrc" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(10) NULL,
"Name" character varying(2048) NULL,
"IndName" character varying(2048) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_ProcedureSrc_Code" UNIQUE ("Code")
);
-- Create "MedicalActionSrcItem" table
CREATE TABLE "public"."MedicalActionSrcItem" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"MedicalActionSrc_Id" bigint NULL,
"ProcedureSrc_Id" bigint NULL,
"Item_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_MedicalActionSrcItem_Item" FOREIGN KEY ("Item_Id") REFERENCES "public"."Item" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_MedicalActionSrcItem_MedicalActionSrc" FOREIGN KEY ("MedicalActionSrc_Id") REFERENCES "public"."MedicalActionSrc" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_MedicalActionSrcItem_ProcedureSrc" FOREIGN KEY ("ProcedureSrc_Id") REFERENCES "public"."ProcedureSrc" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "MedicineGroup" table
CREATE TABLE "public"."MedicineGroup" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(50) NULL,
"Name" character varying(100) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_MedicineGroup_Code" UNIQUE ("Code")
);
-- Create "MedicineMethod" table
CREATE TABLE "public"."MedicineMethod" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(50) NULL,
"Name" character varying(100) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_MedicineMethod_Code" UNIQUE ("Code")
);
-- Create "Medicine" table
CREATE TABLE "public"."Medicine" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(10) NULL,
"Name" character varying(50) NULL,
"MedicineGroup_Code" character varying(10) NULL,
"MedicineMethod_Code" character varying(10) NULL,
"Uom_Code" character varying(10) NULL,
"Dose" smallint NULL,
"Infra_Id" integer NULL,
"Stock" bigint NULL,
"Item_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Medicine_Code" UNIQUE ("Code"),
CONSTRAINT "fk_Medicine_Infra" FOREIGN KEY ("Infra_Id") REFERENCES "public"."Infra" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Medicine_Item" FOREIGN KEY ("Item_Id") REFERENCES "public"."Item" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Medicine_MedicineGroup" FOREIGN KEY ("MedicineGroup_Code") REFERENCES "public"."MedicineGroup" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Medicine_MedicineMethod" FOREIGN KEY ("MedicineMethod_Code") REFERENCES "public"."MedicineMethod" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Medicine_Uom" FOREIGN KEY ("Uom_Code") REFERENCES "public"."Uom" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "MedicineMix" table
CREATE TABLE "public"."MedicineMix" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Name" character varying(50) NULL,
PRIMARY KEY ("Id")
);
-- Create "MedicineMixItem" table
CREATE TABLE "public"."MedicineMixItem" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"MedicineMix_Id" bigint NULL,
"Medicine_Id" bigint NULL,
"Dose" smallint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_MedicineMixItem_Medicine" FOREIGN KEY ("Medicine_Id") REFERENCES "public"."Medicine" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_MedicineMixItem_MedicineMix" FOREIGN KEY ("MedicineMix_Id") REFERENCES "public"."MedicineMix" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Nurse" table
CREATE TABLE "public"."Nurse" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Employee_Id" bigint NULL,
"IHS_Number" character varying(20) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Nurse_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Nutritionist" table
CREATE TABLE "public"."Nutritionist" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Employee_Id" bigint NULL,
"IHS_Number" character varying(20) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Nutritionist_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Ethnic" table
CREATE TABLE "public"."Ethnic" (
"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_Ethnic_Code" UNIQUE ("Code")
);
-- Create "Person" table
CREATE TABLE "public"."Person" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Name" character varying(150) NOT NULL,
"BirthDate" timestamptz NULL,
"BirthRegency_Code" character varying(4) NULL,
"Gender_Code" character varying(10) NULL,
"ResidentIdentityNumber" character varying(16) NULL,
"Religion_Code" character varying(10) NULL,
"Education_Code" character varying(10) NULL,
"Ocupation_Code" character varying(15) NULL,
"Ocupation_Name" character varying(50) NULL,
"Ethnic_Code" character varying(20) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Person_Ethnic" FOREIGN KEY ("Ethnic_Code") REFERENCES "public"."Ethnic" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "PersonAddress" table
CREATE TABLE "public"."PersonAddress" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Person_Id" bigint NULL,
"Address" character varying(150) NULL,
"Rt" character varying(2) NULL,
"Rw" character varying(2) NULL,
"Village_Code" character varying(10) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Person_Addresses" FOREIGN KEY ("Person_Id") REFERENCES "public"."Person" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "PersonContact" table
CREATE TABLE "public"."PersonContact" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Person_Id" bigint NULL,
"Type_Code" character varying(15) NULL,
"Value" character varying(100) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Person_Contacts" FOREIGN KEY ("Person_Id") REFERENCES "public"."Person" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Pharmacist" table
CREATE TABLE "public"."Pharmacist" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Employee_Id" bigint NULL,
"IHS_Number" character varying(20) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Pharmacist_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "PracticeSchedule" table
CREATE TABLE "public"."PracticeSchedule" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Doctor_Id" bigint NULL,
"Unit_Code" character varying(10) NULL,
"Day_Code" smallint NULL,
"StartTime" character varying(5) NULL,
"EndTime" character varying(5) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_PracticeSchedule_Doctor" FOREIGN KEY ("Doctor_Id") REFERENCES "public"."Doctor" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_PracticeSchedule_Unit" FOREIGN KEY ("Unit_Code") REFERENCES "public"."Unit" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Village" table
CREATE TABLE "public"."Village" (
"Id" bigserial NOT NULL,
"District_Code" character varying(6) NULL,
"Code" character varying(10) NULL,
"Name" character varying(50) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Village_Code" UNIQUE ("Code"),
CONSTRAINT "fk_District_Villages" FOREIGN KEY ("District_Code") REFERENCES "public"."District" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION
);
+2
View File
@@ -0,0 +1,2 @@
h1:MMNuESyEk0KZHA2z+7AukfG/ATboITROipz2wK3YNPg=
20250828092003.sql h1:Rr221/6KN53t0eoEHK5+sPeMaVsnKjN4322WLulN8AQ=
+7 -1
View File
@@ -6,10 +6,16 @@ toolchain go1.24.6
require (
ariga.io/atlas-provider-gorm v0.5.6
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/google/uuid v1.6.0
github.com/karincake/apem v0.0.16-h
github.com/karincake/dodol v0.0.1
github.com/karincake/getuk v0.1.0
github.com/karincake/hongkue v0.0.4
github.com/karincake/lepet v0.0.1
github.com/karincake/risoles v0.0.3
github.com/karincake/semprit v0.0.3
github.com/rs/zerolog v1.33.0
golang.org/x/crypto v0.41.0
gorm.io/driver/postgres v1.5.11
gorm.io/gorm v1.25.12
@@ -28,12 +34,12 @@ require (
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/karincake/serabi v0.0.14 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-sqlite3 v1.14.28 // indirect
github.com/microsoft/go-mssqldb v1.7.2 // indirect
github.com/nxadm/tail v1.4.11 // indirect
github.com/rs/zerolog v1.33.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.35.0 // indirect
+10
View File
@@ -32,6 +32,8 @@ github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8w
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw=
github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
@@ -73,8 +75,16 @@ github.com/karincake/dodol v0.0.1 h1:jUXmJh1r0Ei4fmHPZ6IUkoplW/V9d27L63JEl6zudL0
github.com/karincake/dodol v0.0.1/go.mod h1:2f1NcvkvY0J3GMUkwILNDYVvRUpz0W3lpPp/Ha/Ld24=
github.com/karincake/getuk v0.1.0 h1:jcIsASrr0UDE528GN7Ua6n9UFyRgUypsWh8Or8wzCO0=
github.com/karincake/getuk v0.1.0/go.mod h1:NVnvxSGAkQ/xuq99FzWACvY5efyKPLFla1cKB8czm7c=
github.com/karincake/hongkue v0.0.4 h1:oWthq6cDg5DvDm1Z3e7mCLOATQf+oAdtHxN9OPnCfA8=
github.com/karincake/hongkue v0.0.4/go.mod h1:YVi5Lyh3DE+GRHx2OSODOr7FwvLi8U4idvcPHO7yeag=
github.com/karincake/lepet v0.0.1 h1:eq/cwn5BBg0jWZ1c/MmvhFIBma0zBpVs2LwkfDOncy4=
github.com/karincake/lepet v0.0.1/go.mod h1:U84w7olXO3BPJw2Hu6MBonFmJmPKaFjtyAj1HTu3z1A=
github.com/karincake/risoles v0.0.3 h1:7VBShf2yC6NqD0PotQcb0i8Xe6mJeTRrHnE0qzKf7NU=
github.com/karincake/risoles v0.0.3/go.mod h1:u4YS+rPp92ODTbGC4RUx4DxKoThnmPjBl1CNdnmKD/c=
github.com/karincake/semprit v0.0.3 h1:znleGRu73xrHk6a70+jRQgVh9VF3TAhttQz6vfgNdyM=
github.com/karincake/semprit v0.0.3/go.mod h1:nLtNmWlHkxMKG0IMzqnnfkn1L/RVYGXVW3LchfYQMu8=
github.com/karincake/serabi v0.0.14 h1:yK3nBLRXdoUNSUDIfbZqIQxnZ6U6Ij5QEO8d5QzZzsw=
github.com/karincake/serabi v0.0.14/go.mod h1:GcnPBWb+UotDxvb/a2CKwourCEyVIL4P9+YxVmZ5zgk=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
+3 -3
View File
@@ -7,9 +7,9 @@ import (
)
type Base struct {
CreatedAt time.Time `json:"createdAt" gorm:"type:timestamptz"`
UpdatedAt string `json:"updatedAt" gorm:"type:timestamptz"`
DeteledAt gorm.DeletedAt `json:"deletedAt,omitempty"`
CreatedAt time.Time `json:"createdAt" gorm:"column:CreatedAt;type:timestamptz"`
UpdatedAt time.Time `json:"updatedAt" gorm:"column:UpdatedAt;type:timestamptz"`
DeletedAt gorm.DeletedAt `json:"deletedAt,omitempty" gorm:"column:DeletedAt"`
}
type Main struct {
@@ -0,0 +1,83 @@
package counter
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
Number uint8 `json:"number"`
Parent_Id *uint16 `json:"parent_id"`
Type_Code string `json:"type_code"`
Queue_Code string `json:"queue_code"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Number uint8 `json:"number"`
Parent_Id *uint16 `json:"parent_id"`
Type_Code string `json:"type_code"`
Queue_Code string `json:"queue_code"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Number uint8 `json:"number"`
Parent_Id *uint16 `json:"parent_id"`
Type_Code string `json:"type_code"`
Queue_Code string `json:"queue_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"`
Number uint8 `json:"number"`
Parent_Id *uint16 `json:"parent_id"`
Type_Code string `json:"type_code"`
Queue_Code string `json:"queue_code"`
}
func (d Counter) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
Number: d.Number,
Parent_Id: d.Parent_Id,
Type_Code: d.Type_Code,
Queue_Code: d.Queue_Code,
}
resp.SmallMain = d.SmallMain
return resp
}
func ToResponseList(data []Counter) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,15 @@
package counter
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type Counter struct {
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:30"`
Number uint8 `json:"number" gorm:"size:10"`
Parent_Id *uint16 `json:"parent_id"`
Type_Code string `json:"type_code"`
Queue_Code string `json:"queue_code" gorm:"size:5"`
}
@@ -0,0 +1,79 @@
package device
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ei "simrs-vx/internal/domain/main-entities/item"
eu "simrs-vx/internal/domain/main-entities/uom"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
Uom_Code string `json:"uom_code"`
Item_Id *uint `json:"item_id"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Uom_Code string `json:"uom_code"`
Item_Id *uint `json:"item_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Uom_Code string `json:"uom_code"`
Item_Id *uint `json:"item_id"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Code string `json:"code"`
Name string `json:"name"`
Uom_Code string `json:"uom_code"`
Uom *eu.Uom `json:"uom,omitempty"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty"`
}
func (d Device) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
Uom_Code: d.Uom_Code,
Uom: d.Uom,
Item_Id: d.Item_Id,
Item: d.Item,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Device) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,17 @@
package device
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ei "simrs-vx/internal/domain/main-entities/item"
eu "simrs-vx/internal/domain/main-entities/uom"
)
type Device struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
Uom_Code string `json:"uom_code" gorm:"size:10"`
Uom *eu.Uom `json:"uom,omitempty" gorm:"foreignKey:Uom_Code;references:Code"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
}
@@ -0,0 +1,68 @@
package diagnosesrc
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
IndName string `json:"indName"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
IndName string `json:"indName"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
IndName string `json:"indName"`
}
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"`
IndName string `json:"indName"`
}
func (d DiagnoseSrc) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
IndName: d.IndName,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []DiagnoseSrc) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,12 @@
package diagnosesrc
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type DiagnoseSrc struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:2048"`
IndName string `json:"indName" gorm:"size:2048"`
}
@@ -0,0 +1,62 @@
package district
import ev "simrs-vx/internal/domain/main-entities/village"
type CreateDto struct {
Regency_Code string `json:"regency_code" validate:"numeric;maxLength=4"`
Code string `json:"code" validate:"numeric;maxLength=6"`
Name string `json:"name" validate:"alphaSpace;maxLength=50"`
}
type ReadListDto struct {
Regency_Code string `json:"regency_code"`
Code string `json:"code"`
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint32 `json:"id"`
Regency_Code string `json:"regency_code"`
Code string `json:"code"`
Name string `json:"name"`
}
type UpdateDto struct {
Id uint32 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint32 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
Id uint32 `json:"id"`
Regency_Code string `json:"regency_code"`
Code string `json:"code"`
Name string `json:"name"`
Villages []*ev.Village `json:"villages,omitempty"`
}
func (d District) ToResponse() ResponseDto {
resp := ResponseDto(d)
return resp
}
func ToResponseList(data []District) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,11 @@
package district
import ev "simrs-vx/internal/domain/main-entities/village"
type District struct {
Id uint32 `json:"id" gorm:"primaryKey"`
Regency_Code string `json:"regency_code" gorm:"size:4"`
Code string `json:"code" gorm:"unique;size:6"` // NOTE: THE PROPER SIZE IS 6
Name string `json:"name" gorm:"size:50"`
Villages []*ev.Village `json:"villages,omitempty" gorm:"foreignKey:District_Code;references:Code"`
}
@@ -0,0 +1,73 @@
package divisionposition
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/division"
)
type CreateDto struct {
Division_Id *uint16 `json:"division_id"`
Code string `json:"code"`
Name string `json:"name"`
}
type ReadListDto struct {
Division_Id *uint16 `json:"division_id"`
Code string `json:"code"`
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Division_Id *uint16 `json:"division_id"`
Code string `json:"code"`
Name string `json:"name"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.SmallMain
Division_Id *uint16 `json:"division_id"`
Division *ed.Division `json:"division,omitempty"`
Code string `json:"code"`
Name string `json:"name"`
}
func (d DivisionPosition) ToResponse() ResponseDto {
resp := ResponseDto{
Division_Id: d.Division_Id,
Code: d.Code,
Name: d.Name,
}
resp.SmallMain = d.SmallMain
if d.Division != nil {
resp.Division = d.Division
}
return resp
}
func ToResponseList(data []DivisionPosition) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,14 @@
package divisionposition
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/division"
)
type DivisionPosition struct {
ecore.SmallMain // adjust this according to the needs
Division_Id *uint16 `json:"division_id"`
Division *ed.Division `json:"division" gorm:"foreignKey:Division_Id"`
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
}
@@ -0,0 +1,68 @@
package division
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"`
}
func (d Division) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
Parent_Id: d.Parent_Id,
}
resp.SmallMain = d.SmallMain
return resp
}
func ToResponseList(data []Division) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,12 @@
package division
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type Division struct {
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
Parent_Id *int16 `json:"parent_id"`
}
@@ -0,0 +1,80 @@
package doctorfee
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/doctor"
ei "simrs-vx/internal/domain/main-entities/item"
erc "simrs-vx/internal/domain/references/clinical"
)
type CreateDto struct {
Doctor_Id *uint `json:"doctor_id"`
FeeType_Code *erc.DoctorFeeTypeCode `json:"feeType_code"`
Price *float64 `json:"price"`
Item_Id *uint `json:"item_id"`
}
type ReadListDto struct {
Doctor_Id *uint `json:"doctor_id"`
FeeType_Code *erc.DoctorFeeTypeCode `json:"feeType_code"`
Price *float64 `json:"price"`
Item_Id *uint `json:"item_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Doctor_Id *uint `json:"doctor_id"`
FeeType_Code *erc.DoctorFeeTypeCode `json:"feeType_code"`
Price *float64 `json:"price"`
Item_Id *uint `json:"item_id"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Doctor_Id *uint `json:"doctor_id"`
Doctor *ed.Doctor `json:"doctor,omitempty"`
FeeType_Code *erc.DoctorFeeTypeCode `json:"feeType_code"`
Price *float64 `json:"price"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty"`
}
func (d DoctorFee) ToResponse() ResponseDto {
resp := ResponseDto{
Doctor_Id: d.Doctor_Id,
Doctor: d.Doctor,
FeeType_Code: d.FeeType_Code,
Price: d.Price,
Item_Id: d.Item_Id,
Item: d.Item,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []DoctorFee) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,18 @@
package doctorfee
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/doctor"
ei "simrs-vx/internal/domain/main-entities/item"
erc "simrs-vx/internal/domain/references/clinical"
)
type DoctorFee struct {
ecore.Main // adjust this according to the needs
Doctor_Id *uint `json:"doctor_id"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"`
FeeType_Code *erc.DoctorFeeTypeCode `json:"feeType_code" gorm:"size:11"`
Price *float64 `json:"price"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
}
@@ -0,0 +1,79 @@
package doctor
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
eu "simrs-vx/internal/domain/main-entities/unit"
)
type CreateDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
SIP_Number *string `json:"sip_number"`
Unit_Id *uint `json:"unit_id"`
}
type ReadListDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
SIP_Number *string `json:"sip_number"`
Unit_Id *uint `json:"unit_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
SIP_Number *string `json:"sip_number"`
Unit_Id *uint `json:"unit_id"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"`
IHS_Number *string `json:"ihs_number"`
SIP_Number *string `json:"sip_number"`
Unit_Id *uint `json:"unit_id"`
Unit *eu.Unit `json:"unit,omitempty"`
}
func (d Doctor) ToResponse() ResponseDto {
resp := ResponseDto{
Employee_Id: d.Employee_Id,
Employee: d.Employee,
IHS_Number: d.IHS_Number,
SIP_Number: d.SIP_Number,
Unit_Id: d.Unit_Id,
Unit: d.Unit,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Doctor) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,17 @@
package doctor
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
eu "simrs-vx/internal/domain/main-entities/unit"
)
type Doctor struct {
ecore.Main // adjust this according to the needs
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
IHS_Number *string `json:"ihs_number" gorm:"size:20"`
SIP_Number *string `json:"sip_number" gorm:"size:20"`
Unit_Id *uint `json:"unit_id"`
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
}
@@ -0,0 +1,19 @@
package employee
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/division"
erc "simrs-vx/internal/domain/references/common"
ero "simrs-vx/internal/domain/references/organization"
)
type Employee struct {
ecore.Main // adjust this according to the needs
User_Id *uint `json:"user_id"`
Person_Id *uint `json:"person_id"`
Position_Code ero.EmployeePosisitionCode `json:"position_code" gorm:"not null;size:20"`
Division_Code *string `json:"division_code"`
Division *ed.Division `json:"division,omitempty" gorm:"foreignKey:Division_Code;references:Code"`
Number *string `json:"number" gorm:"size:20"`
Status_Code erc.StatusCode `json:"status_code" gorm:"not null;size:10"`
}
@@ -0,0 +1,88 @@
package employee
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/division"
erc "simrs-vx/internal/domain/references/common"
ero "simrs-vx/internal/domain/references/organization"
)
type CreateDto struct {
User_Id *uint `json:"user_id"`
Person_Id *uint `json:"person_id"`
Position_Code ero.EmployeePosisitionCode `json:"position_code"`
Division_Code *string `json:"division_code"`
Number *string `json:"number"`
Status_Code erc.StatusCode `json:"status_code"`
}
type ReadListDto struct {
User_Id *uint `json:"user_id"`
Person_Id *uint `json:"person_id"`
Position_Code ero.EmployeePosisitionCode `json:"position_code"`
Division_Code *string `json:"division_code"`
Number *string `json:"number"`
Status_Code erc.StatusCode `json:"status_code"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
User_Id *uint `json:"user_id"`
Person_Id *uint `json:"person_id"`
Position_Code ero.EmployeePosisitionCode `json:"position_code"`
Division_Code *string `json:"division_code"`
Number *string `json:"number"`
Status_Code erc.StatusCode `json:"status_code"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
User_Id *uint `json:"user_id"`
Person_Id *uint `json:"person_id"`
Position_Code ero.EmployeePosisitionCode `json:"position_code"`
Division_Code *string `json:"division_code"`
Division *ed.Division `json:"division,omitempty"`
Number *string `json:"number"`
Status_Code erc.StatusCode `json:"status_code"`
}
func (d Employee) ToResponse() ResponseDto {
resp := ResponseDto{
User_Id: d.User_Id,
Person_Id: d.Person_Id,
Position_Code: d.Position_Code,
Division_Code: d.Division_Code,
Division: d.Division,
Number: d.Number,
Status_Code: d.Status_Code,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Employee) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,19 @@
package employee
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/division"
erc "simrs-vx/internal/domain/references/common"
ero "simrs-vx/internal/domain/references/organization"
)
type Employee struct {
ecore.Main // adjust this according to the needs
User_Id *uint `json:"user_id"`
Person_Id *uint `json:"person_id"`
Position_Code ero.EmployeePosisitionCode `json:"position_code" gorm:"not null;size:20"`
Division_Code *string `json:"division_code"`
Division *ed.Division `json:"division,omitempty" gorm:"foreignKey:Division_Code;references:Code"`
Number *string `json:"number" gorm:"size:20"`
Status_Code erc.StatusCode `json:"status_code" gorm:"not null;size:10"`
}
@@ -0,0 +1,63 @@
package ethnic
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
}
func (d Ethnic) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
}
resp.SmallMain = d.SmallMain
return resp
}
func ToResponseList(data []Ethnic) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,11 @@
package ethnic
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type Ethnic 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,68 @@
package infragroup
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
Level uint8 `json:"level"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Level uint8 `json:"level"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Level uint8 `json:"level"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Code string `json:"code"`
Name string `json:"name"`
Level uint8 `json:"level"`
}
func (d InfraGroup) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
Level: d.Level,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []InfraGroup) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,12 @@
package infragroup
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type InfraGroup struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
Level uint8 `json:"level"`
}
@@ -0,0 +1,84 @@
package infra
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eig "simrs-vx/internal/domain/main-entities/infra-group"
ei "simrs-vx/internal/domain/main-entities/item"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code *string `json:"infraGroup_code"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code *string `json:"infraGroup_code"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code *string `json:"infraGroup_code"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code *string `json:"infraGroup_code"`
InfraGroup *eig.InfraGroup `json:"infraGroup,omitempty"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty"`
}
func (d Infra) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
InfraGroup_Code: d.InfraGroup_Code,
InfraGroup: d.InfraGroup,
Parent_Id: d.Parent_Id,
Item_Id: d.Item_Id,
Item: d.Item,
}
resp.SmallMain = d.SmallMain
return resp
}
func ToResponseList(data []Infra) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,18 @@
package infra
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eig "simrs-vx/internal/domain/main-entities/infra-group"
ei "simrs-vx/internal/domain/main-entities/item"
)
type Infra struct {
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
InfraGroup_Code *string `json:"infraGroup_code" gorm:"size:10"`
InfraGroup *eig.InfraGroup `json:"infraGroup,omitempty" gorm:"foreignKey:InfraGroup_Code;references:Code"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
}
@@ -0,0 +1,69 @@
package installation
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ere "simrs-vx/internal/domain/references/encounter"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
EncounterClass_Code ere.EncounterClass `json:"encounterClass_code"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
EncounterClass_Code ere.EncounterClass `json:"encounterClass_code"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
EncounterClass_Code ere.EncounterClass `json:"encounterClass_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"`
EncounterClass_Code ere.EncounterClass `json:"encounterClass_code"`
}
func (d Installation) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
EncounterClass_Code: d.EncounterClass_Code,
}
resp.SmallMain = d.SmallMain
return resp
}
func ToResponseList(data []Installation) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,13 @@
package installation
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ere "simrs-vx/internal/domain/references/encounter"
)
type Installation struct {
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
EncounterClass_Code ere.EncounterClass `json:"encounterClass_code" gorm:"size:10"`
}
@@ -0,0 +1,81 @@
package insurancecompany
import (
ecore "simrs-vx/internal/domain/base-entities/core"
er "simrs-vx/internal/domain/main-entities/regency"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
Regency_Code *string `json:"regency_code"`
Address string `json:"address"`
PhoneNumber string `json:"phoneNumber"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Regency_Code *string `json:"regency_code"`
Address string `json:"address"`
PhoneNumber string `json:"phoneNumber"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Regency_Code *string `json:"regency_code"`
Address string `json:"address"`
PhoneNumber string `json:"phoneNumber"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
Regency_Code *string `json:"regency_code"`
Regency *er.Regency `json:"regency,omitempty"`
Address string `json:"address"`
PhoneNumber string `json:"phoneNumber"`
}
func (d InsuranceCompany) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
Regency_Code: d.Regency_Code,
Regency: d.Regency,
Address: d.Address,
PhoneNumber: d.PhoneNumber,
}
resp.SmallMain = d.SmallMain
return resp
}
func ToResponseList(data []InsuranceCompany) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,16 @@
package insurancecompany
import (
ecore "simrs-vx/internal/domain/base-entities/core"
er "simrs-vx/internal/domain/main-entities/regency"
)
type InsuranceCompany struct {
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:20"`
Name string `json:"name" gorm:"size:50"`
Regency_Code *string `json:"regency_code" gorm:"size:4"`
Regency *er.Regency `json:"regency,omitempty" gorm:"foreignKey:Regency_Code;references:Code"`
Address string `json:"address" gorm:"size:100"`
PhoneNumber string `json:"phoneNumber" gorm:"size:20"`
}
@@ -0,0 +1,63 @@
package itemgroup
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Code string `json:"code"`
Name string `json:"name"`
}
func (d ItemGroup) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []ItemGroup) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,11 @@
package itemgroup
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type ItemGroup struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:50"`
Name string `json:"name" gorm:"size:100"`
}
@@ -0,0 +1,74 @@
package itemprice
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eic "simrs-vx/internal/domain/main-entities/insurance-company"
ei "simrs-vx/internal/domain/main-entities/item"
)
type CreateDto struct {
Item_Id *uint `json:"item_id"`
Price float64 `json:"price"`
InsuranceCompany_Code *string `json:"insuranceCompany_code"`
}
type ReadListDto struct {
Item_Id *uint `json:"item_id"`
Price float64 `json:"price"`
InsuranceCompany_Code *string `json:"insuranceCompany_code"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Item_Id *uint `json:"item_id"`
Price float64 `json:"price"`
InsuranceCompany_Code *string `json:"insuranceCompany_code"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty"`
Price float64 `json:"price"`
InsuranceCompany_Code *string `json:"insuranceCompany_code"`
InsuranceCompany *eic.InsuranceCompany `json:"insuranceCompany,omitempty"`
}
func (d ItemPrice) ToResponse() ResponseDto {
resp := ResponseDto{
Item_Id: d.Item_Id,
Item: d.Item,
Price: d.Price,
InsuranceCompany_Code: d.InsuranceCompany_Code,
InsuranceCompany: d.InsuranceCompany,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []ItemPrice) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,16 @@
package itemprice
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eic "simrs-vx/internal/domain/main-entities/insurance-company"
ei "simrs-vx/internal/domain/main-entities/item"
)
type ItemPrice struct {
ecore.Main // adjust this according to the needs
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
Price float64 `json:"price"`
InsuranceCompany_Code *string `json:"insuranceCompany_code" gorm:"size:20"`
InsuranceCompany *eic.InsuranceCompany `json:"insuranceCompany,omitempty" gorm:"foreignKey:InsuranceCompany_Code;references:Code"`
}
+89
View File
@@ -0,0 +1,89 @@
package item
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eig "simrs-vx/internal/domain/main-entities/item-group"
eu "simrs-vx/internal/domain/main-entities/uom"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code *string `json:"itemGroup_code"`
Uom_Code *string `json:"uom_code"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code *string `json:"itemGroup_code"`
Uom_Code *string `json:"uom_code"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code *string `json:"itemGroup_code"`
Uom_Code *string `json:"uom_code"`
Infra_Id *int16 `json:"infra_id"`
Stock *int `json:"stock"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code *string `json:"itemGroup_code"`
ItemGroup *eig.ItemGroup `json:"itemGroup,omitempty"`
Uom_Code *string `json:"uom_code"`
Uom *eu.Uom `json:"uom,omitempty"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
}
func (d Item) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
ItemGroup_Code: d.ItemGroup_Code,
ItemGroup: d.ItemGroup,
Uom_Code: d.Uom_Code,
Uom: d.Uom,
Infra_Id: d.Infra_Id,
Stock: d.Stock,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Item) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,19 @@
package item
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eig "simrs-vx/internal/domain/main-entities/item-group"
eu "simrs-vx/internal/domain/main-entities/uom"
)
type Item struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:50"`
Name string `json:"name" gorm:"size:100"`
ItemGroup_Code *string `json:"itemGroup_code" gorm:"size:10"`
ItemGroup *eig.ItemGroup `json:"itemGroup,omitempty" gorm:"foreignKey:ItemGroup_Code;references:Code"`
Uom_Code *string `json:"uom_code" gorm:"size:10"`
Uom *eu.Uom `json:"uom,omitempty" gorm:"foreignKey:Uom_Code;references:Code"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
}
@@ -0,0 +1,84 @@
package material
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ei "simrs-vx/internal/domain/main-entities/item"
eu "simrs-vx/internal/domain/main-entities/uom"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
Uom_Code string `json:"uom_code"`
Stock *int `json:"stock"`
Item_Id *uint `json:"item_id"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Uom_Code string `json:"uom_code"`
Stock *int `json:"stock"`
Item_Id *uint `json:"item_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Uom_Code string `json:"uom_code"`
Stock *int `json:"stock"`
Item_Id *uint `json:"item_id"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Code string `json:"code"`
Name string `json:"name"`
Uom_Code string `json:"uom_code"`
Uom *eu.Uom `json:"uom,omitempty"`
Stock *int `json:"stock"`
Item_Id *uint `json:"item_id"`
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,
Stock: d.Stock,
Item_Id: d.Item_Id,
Item: d.Item,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Material) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,18 @@
package material
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ei "simrs-vx/internal/domain/main-entities/item"
eu "simrs-vx/internal/domain/main-entities/uom"
)
type Material struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
Uom_Code string `json:"uom_code" gorm:"size:10"`
Uom *eu.Uom `json:"uom,omitempty" gorm:"foreignKey:Uom_Code;references:Code"`
Stock *int `json:"stock"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
}
@@ -0,0 +1,69 @@
package division
import (
ecore "simrs-vx/internal/domain/base-entities/core"
erc "simrs-vx/internal/domain/references/clinical"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
Scope_Code *erc.CheckupScopeCode `json:"scope_code"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Scope_Code *erc.CheckupScopeCode `json:"scope_code"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Scope_Code *erc.CheckupScopeCode `json:"scope_code"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
Scope_Code *erc.CheckupScopeCode `json:"scope_code"`
}
func (d McuSrcCategory) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
Scope_Code: d.Scope_Code,
}
resp.SmallMain = d.SmallMain
return resp
}
func ToResponseList(data []McuSrcCategory) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,13 @@
package division
import (
ecore "simrs-vx/internal/domain/base-entities/core"
erc "simrs-vx/internal/domain/references/clinical"
)
type McuSrcCategory struct {
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:20"`
Name string `json:"name" gorm:"size:50"`
Scope_Code *erc.CheckupScopeCode `json:"scope_code" gorm:"size:10"`
}
@@ -0,0 +1,68 @@
package mcusrc
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
CheckupCategory_Code *string `json:"checkupCategory_code"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
CheckupCategory_Code *string `json:"checkupCategory_code"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
CheckupCategory_Code *string `json:"checkupCategory_code"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
CheckupCategory_Code *string `json:"checkupCategory_code"`
}
func (d McuSrc) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
CheckupCategory_Code: d.CheckupCategory_Code,
}
resp.SmallMain = d.SmallMain
return resp
}
func ToResponseList(data []McuSrc) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,12 @@
package mcusrc
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type McuSrc struct {
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:20"`
Name string `json:"name" gorm:"size:50"`
CheckupCategory_Code *string `json:"checkupCategory_code" gorm:"size:20"`
}
@@ -0,0 +1,77 @@
package medicalactionsrcitem
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ei "simrs-vx/internal/domain/main-entities/item"
emas "simrs-vx/internal/domain/main-entities/medical-action-src"
eps "simrs-vx/internal/domain/main-entities/procedure-src"
)
type CreateDto struct {
MedicalActionSrc_Id *uint `json:"medicalActionSrc_id"`
ProcedureSrc_Id *uint `json:"procedureSrc_id"`
Item_Id *uint `json:"item_id"`
}
type ReadListDto struct {
MedicalActionSrc_Id *uint `json:"medicalActionSrc_id"`
ProcedureSrc_Id *uint `json:"procedureSrc_id"`
Item_Id *uint `json:"item_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
MedicalActionSrc_Id *uint `json:"medicalActionSrc_id"`
ProcedureSrc_Id *uint `json:"procedureSrc_id"`
Item_Id *uint `json:"item_id"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
MedicalActionSrc_Id *uint `json:"medicalActionSrc_id"`
MedicalActionSrc *emas.MedicalActionSrc `json:"medicalActionSrc,omitempty"`
ProcedureSrc_Id *uint `json:"procedureSrc_id"`
ProcedureSrc *eps.ProcedureSrc `json:"procedureSrc,omitempty"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty"`
}
func (d MedicalActionSrcItem) ToResponse() ResponseDto {
resp := ResponseDto{
MedicalActionSrc_Id: d.MedicalActionSrc_Id,
MedicalActionSrc: d.MedicalActionSrc,
ProcedureSrc_Id: d.ProcedureSrc_Id,
ProcedureSrc: d.ProcedureSrc,
Item_Id: d.Item_Id,
Item: d.Item,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []MedicalActionSrcItem) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,18 @@
package medicalactionsrcitem
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ei "simrs-vx/internal/domain/main-entities/item"
emas "simrs-vx/internal/domain/main-entities/medical-action-src"
eps "simrs-vx/internal/domain/main-entities/procedure-src"
)
type MedicalActionSrcItem struct {
ecore.Main // adjust this according to the needs
MedicalActionSrc_Id *uint `json:"medicalActionSrc_id"`
MedicalActionSrc *emas.MedicalActionSrc `json:"medicalActionSrc,omitempty" gorm:"foreignKey:MedicalActionSrc_Id;references:Id"`
ProcedureSrc_Id *uint `json:"procedureSrc_id"`
ProcedureSrc *eps.ProcedureSrc `json:"procedureSrc,omitempty" gorm:"foreignKey:ProcedureSrc_Id;references:Id"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
}
@@ -0,0 +1,71 @@
package medicalactionsrc
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ei "simrs-vx/internal/domain/main-entities/item"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
Item_Id *uint `json:"item_id"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Item_Id *uint `json:"item_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Item_Id *uint `json:"item_id"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Code string `json:"code"`
Name string `json:"name"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty"`
}
func (d MedicalActionSrc) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
Item_Id: d.Item_Id,
Item: d.Item,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []MedicalActionSrc) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,14 @@
package medicalactionsrc
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ei "simrs-vx/internal/domain/main-entities/item"
)
type MedicalActionSrc struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:20"`
Name string `json:"name" gorm:"size:50"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
}
@@ -0,0 +1,63 @@
package medicinegroup
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
}
func (d MedicineGroup) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
}
resp.SmallMain = d.SmallMain
return resp
}
func ToResponseList(data []MedicineGroup) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,11 @@
package medicinegroup
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type MedicineGroup struct {
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:50"`
Name string `json:"name" gorm:"size:100"`
}
@@ -0,0 +1,63 @@
package medicinemethod
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
}
func (d MedicineMethod) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
}
resp.SmallMain = d.SmallMain
return resp
}
func ToResponseList(data []MedicineMethod) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,11 @@
package medicinemethod
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type MedicineMethod struct {
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:50"`
Name string `json:"name" gorm:"size:100"`
}
@@ -0,0 +1,74 @@
package medicinemixitem
import (
ecore "simrs-vx/internal/domain/base-entities/core"
em "simrs-vx/internal/domain/main-entities/medicine"
emm "simrs-vx/internal/domain/main-entities/medicine-mix"
)
type CreateDto struct {
MedicineMix_Id *uint `json:"medicineMix_id"`
Medicine_Id *uint `json:"medicine_id"`
Dose *uint8 `json:"dose"`
}
type ReadListDto struct {
MedicineMix_Id *uint `json:"medicineMix_id"`
Medicine_Id *uint `json:"medicine_id"`
Dose *uint8 `json:"dose"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
MedicineMix_Id *uint `json:"medicineMix_id"`
Medicine_Id *uint `json:"medicine_id"`
Dose *uint8 `json:"dose"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
MedicineMix_Id *uint `json:"medicineMix_id"`
MedicineMix *emm.MedicineMix `json:"medicineMix,omitempty"`
Medicine_Id *uint `json:"medicine_id"`
Medicine *em.Medicine `json:"medicine,omitempty"`
Dose *uint8 `json:"dose"`
}
func (d MedicineMixItem) ToResponse() ResponseDto {
resp := ResponseDto{
MedicineMix_Id: d.MedicineMix_Id,
MedicineMix: d.MedicineMix,
Medicine_Id: d.Medicine_Id,
Medicine: d.Medicine,
Dose: d.Dose,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []MedicineMixItem) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,16 @@
package medicinemixitem
import (
ecore "simrs-vx/internal/domain/base-entities/core"
em "simrs-vx/internal/domain/main-entities/medicine"
emm "simrs-vx/internal/domain/main-entities/medicine-mix"
)
type MedicineMixItem struct {
ecore.Main // adjust this according to the needs
MedicineMix_Id *uint `json:"medicineMix_id"`
MedicineMix *emm.MedicineMix `json:"medicineMix,omitempty" gorm:"foreignKey:MedicineMix_Id;references:Id"`
Medicine_Id *uint `json:"medicine_id"`
Medicine *em.Medicine `json:"medicine,omitempty" gorm:"foreignKey:Medicine_Id;references:Id"`
Dose *uint8 `json:"dose"`
}
@@ -0,0 +1,58 @@
package medicinemix
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Name string `json:"name"`
}
type ReadListDto struct {
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Name string `json:"name"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Name string `json:"name"`
}
func (d MedicineMix) ToResponse() ResponseDto {
resp := ResponseDto{
Name: d.Name,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []MedicineMix) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,10 @@
package medicinemix
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type MedicineMix struct {
ecore.Main // adjust this according to the needs
Name string `json:"name" gorm:"size:50"`
}
@@ -0,0 +1,114 @@
package medicine
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ein "simrs-vx/internal/domain/main-entities/infra"
eit "simrs-vx/internal/domain/main-entities/item"
emg "simrs-vx/internal/domain/main-entities/medicine-group"
emm "simrs-vx/internal/domain/main-entities/medicine-method"
eu "simrs-vx/internal/domain/main-entities/uom"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
MedicineGroup_Code *string `json:"medicineGroup_code"`
MedicineMethod_Code *string `json:"medicineMethod_code"`
Uom_Code *string `json:"uom_code"`
Dose uint8 `json:"dose"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
Item_Id *uint `json:"item_id"`
InsuranceCompany_Code *string `json:"insuranceCompany_code"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
MedicineGroup_Code *string `json:"medicineGroup_code"`
MedicineMethod_Code *string `json:"medicineMethod_code"`
Uom_Code *string `json:"uom_code"`
Dose uint8 `json:"dose"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
Item_Id *uint `json:"item_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
MedicineGroup_Code *string `json:"medicineGroup_code"`
MedicineMethod_Code *string `json:"medicineMethod_code"`
Uom_Code *string `json:"uom_code"`
Dose uint8 `json:"dose"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
Item_Id *uint `json:"item_id"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Code string `json:"code"`
Name string `json:"name"`
MedicineGroup_Code *string `json:"medicineGroup_code"`
MedicineGroup *emg.MedicineGroup `json:"medicineGroup"`
MedicineMethod_Code *string `json:"medicineMethod_code"`
MedicineMethod *emm.MedicineMethod `json:"medicineMethod"`
Uom_Code *string `json:"uom_code"`
Uom *eu.Uom `json:"uom"`
Dose uint8 `json:"dose"`
Infra_Id *uint16 `json:"infra_id"`
Infra *ein.Infra `json:"infra,omitempty"`
Stock *int `json:"stock"`
Item_Id *uint `json:"item_id"`
Item *eit.Item `json:"item,omitempty"`
}
func (d Medicine) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
MedicineGroup_Code: d.MedicineGroup_Code,
MedicineGroup: d.MedicineGroup,
MedicineMethod_Code: d.MedicineMethod_Code,
MedicineMethod: d.MedicineMethod,
Uom_Code: d.Uom_Code,
Uom: d.Uom,
Dose: d.Dose,
Infra_Id: d.Infra_Id,
Infra: d.Infra,
Stock: d.Stock,
Item_Id: d.Item_Id,
Item: d.Item,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Medicine) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,28 @@
package medicine
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ein "simrs-vx/internal/domain/main-entities/infra"
eit "simrs-vx/internal/domain/main-entities/item"
emg "simrs-vx/internal/domain/main-entities/medicine-group"
emm "simrs-vx/internal/domain/main-entities/medicine-method"
eu "simrs-vx/internal/domain/main-entities/uom"
)
type Medicine struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
MedicineGroup_Code *string `json:"medicineGroup_code" gorm:"size:10"`
MedicineGroup *emg.MedicineGroup `json:"medicineGroup,omitempty" gorm:"foreignKey:MedicineGroup_Code;references:Code"`
MedicineMethod_Code *string `json:"medicineMethod_code" gorm:"size:10"`
MedicineMethod *emm.MedicineMethod `json:"medicineMethod,omitempty" gorm:"foreignKey:MedicineMethod_Code;references:Code"`
Uom_Code *string `json:"uom_code" gorm:"size:10"`
Uom *eu.Uom `json:"uom" gorm:"foreignKey:Uom_Code;references:Code"`
Dose uint8 `json:"dose"`
Infra_Id *uint16 `json:"infra_id"`
Infra *ein.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"`
Stock *int `json:"stock"`
Item_Id *uint `json:"item_id"`
Item *eit.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
}
@@ -0,0 +1,66 @@
package nurse
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
)
type CreateDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
}
type ReadListDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"`
IHS_Number *string `json:"ihs_number"`
}
func (d Nurse) ToResponse() ResponseDto {
resp := ResponseDto{
Employee_Id: d.Employee_Id,
Employee: d.Employee,
IHS_Number: d.IHS_Number,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Nurse) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,13 @@
package nurse
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
)
type Nurse struct {
ecore.Main // adjust this according to the needs
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
IHS_Number *string `json:"ihs_number" gorm:"size:20"`
}
@@ -0,0 +1,66 @@
package nutritionist
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
)
type CreateDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
}
type ReadListDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"`
IHS_Number *string `json:"ihs_number"`
}
func (d Nutritionist) ToResponse() ResponseDto {
resp := ResponseDto{
Employee_Id: d.Employee_Id,
Employee: d.Employee,
IHS_Number: d.IHS_Number,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Nutritionist) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,13 @@
package nutritionist
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
)
type Nutritionist struct {
ecore.Main // adjust this according to the needs
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
IHS_Number *string `json:"ihs_number" gorm:"size:20"`
}
@@ -0,0 +1,72 @@
package personaddress
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Person_Id uint `json:"person_id"`
Address string `json:"address"`
Rt string `json:"rt"`
Rw string `json:"rw"`
Village_Code string `json:"village_code"`
}
type ReadListDto struct {
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint `json:"id"`
Person_Id uint `json:"person_id"`
Address string `json:"address"`
Rt string `json:"rt"`
Rw string `json:"rw"`
Village_Code string `json:"village_code"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Person_Id uint `json:"person_id"`
Address string `json:"address"`
Rt string `json:"rt"`
Rw string `json:"rw"`
Village_Code string `json:"village_code"`
}
func (d PersonAddress) ToResponse() ResponseDto {
resp := ResponseDto{
Person_Id: d.Person_Id,
Address: d.Address,
Rt: d.Rt,
Rw: d.Rw,
Village_Code: d.Village_Code,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []PersonAddress) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,14 @@
package personaddress
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type PersonAddress struct {
ecore.Main // adjust this according to the needs
Person_Id uint `json:"person_id"`
Address string `json:"address" gorm:"size:150"`
Rt string `json:"rt" gorm:"size:2"`
Rw string `json:"rw" gorm:"size:2"`
Village_Code string `json:"village_code" gorm:"size:10"`
}
@@ -0,0 +1,65 @@
package personcontact
import (
ecore "simrs-vx/internal/domain/base-entities/core"
erp "simrs-vx/internal/domain/references/person"
)
type CreateDto struct {
Person_Id uint `json:"person_id"`
Type_Code erp.ContactTypeCode `json:"type_code"`
Value string `json:"value"`
}
type ReadListDto struct {
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint `json:"id"`
Person_Id uint `json:"person_id"`
Type_Code erp.ContactTypeCode `json:"type_code"`
Value string `json:"value"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Person_Id uint `json:"person_id"`
Type_Code erp.ContactTypeCode `json:"type_code"`
Value string `json:"value"`
}
func (d *PersonContact) ToResponse() ResponseDto {
resp := ResponseDto{
Person_Id: d.Person_Id,
Type_Code: d.Type_Code,
Value: d.Value,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []PersonContact) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,13 @@
package personcontact
import (
ecore "simrs-vx/internal/domain/base-entities/core"
erp "simrs-vx/internal/domain/references/person"
)
type PersonContact struct {
ecore.Main // adjust this according to the needs
Person_Id uint `json:"person_id"`
Type_Code erp.ContactTypeCode `json:"type_code" gorm:"size:15"`
Value string `json:"value" gorm:"size:100"`
}
+103
View File
@@ -0,0 +1,103 @@
package person
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/ethnic"
epa "simrs-vx/internal/domain/main-entities/person-address"
epc "simrs-vx/internal/domain/main-entities/person-contact"
erp "simrs-vx/internal/domain/references/person"
"time"
)
type CreateDto struct {
Name string `json:"name"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
Religion_Code *erp.ReligionCode `json:"religion_code"`
Education_Code *erp.EducationCode `json:"education_code"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code"`
Ocupation_Name *string `json:"occupation_name"`
Ethnic_Code *string `json:"ethnic_code"`
}
type ReadListDto struct {
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint `json:"id"`
Name string `json:"name"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
Religion_Code *erp.ReligionCode `json:"religion_code"`
Education_Code *erp.EducationCode `json:"education_code"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code"`
Ocupation_Name *string `json:"occupation_name"`
Ethnic_Code *string `json:"ethnic_code"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Name string `json:"name"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
Religion_Code *erp.ReligionCode `json:"religion_code"`
Education_Code *erp.EducationCode `json:"education_code"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code"`
Ocupation_Name *string `json:"occupation_name"`
Ethnic_Code *string `json:"ethnic_code"`
Ethnic *ee.Ethnic `json:"ethnic,omitempty"`
Addresses *[]epa.PersonAddress `json:"addresses,omitempty"`
Contacts *[]epc.PersonContact `json:"contacts,omitempty"`
}
func (d *Person) ToResponse() ResponseDto {
resp := ResponseDto{
Name: d.Name,
BirthDate: d.BirthDate,
BirthRegency_Code: d.BirthRegency_Code,
Gender_Code: d.Gender_Code,
ResidentIdentityNumber: d.ResidentIdentityNumber,
Religion_Code: d.Religion_Code,
Education_Code: d.Education_Code,
Ocupation_Code: d.Ocupation_Code,
Ocupation_Name: d.Ocupation_Name,
Ethnic_Code: d.Ethnic_Code,
Ethnic: d.Ethnic,
Addresses: d.Addresses,
Contacts: d.Contacts,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Person) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,28 @@
package person
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/ethnic"
epa "simrs-vx/internal/domain/main-entities/person-address"
epc "simrs-vx/internal/domain/main-entities/person-contact"
erp "simrs-vx/internal/domain/references/person"
"time"
)
type Person struct {
ecore.Main // adjust this according to the needs
Name string `json:"name" gorm:"not null;size:150"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code" gorm:"size:4"`
Gender_Code *erp.GenderCode `json:"gender_code" gorm:"size:10"`
ResidentIdentityNumber *string `json:"residentIdentityNumber" gorm:"size:16"`
Religion_Code *erp.ReligionCode `json:"religion_code" gorm:"size:10"`
Education_Code *erp.EducationCode `json:"education_code" gorm:"size:10"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code" gorm:"size:15"`
Ocupation_Name *string `json:"occupation_name" gorm:"size:50"`
Ethnic_Code *string `json:"ethnic_code" gorm:"size:20"`
Ethnic *ee.Ethnic `json:"ethnic,omitempty" gorm:"foreignKey:Ethnic_Code;references:Code"`
Addresses *[]epa.PersonAddress `json:"addresses" gorm:"foreignKey:Person_Id"`
Contacts *[]epc.PersonContact `json:"contacts" gorm:"foreignKey:Person_Id"`
}
@@ -0,0 +1,66 @@
package pharmacist
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
)
type CreateDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
}
type ReadListDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"`
IHS_Number *string `json:"ihs_number"`
}
func (d Pharmacist) ToResponse() ResponseDto {
resp := ResponseDto{
Employee_Id: d.Employee_Id,
Employee: d.Employee,
IHS_Number: d.IHS_Number,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Pharmacist) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,13 @@
package pharmacist
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
)
type Pharmacist struct {
ecore.Main // adjust this according to the needs
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
IHS_Number *string `json:"ihs_number" gorm:"size:20"`
}
@@ -0,0 +1,68 @@
package pharmacycompany
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
Regency_Code string `json:"regency_code"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Regency_Code string `json:"regency_code"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Regency_Code string `json:"regency_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"`
Regency_Code string `json:"regency_code"`
}
func (d PharmacyCompany) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
Regency_Code: d.Regency_Code,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []PharmacyCompany) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,12 @@
package pharmacycompany
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type PharmacyCompany struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:20"`
Name string `json:"name" gorm:"size:100"`
Regency_Code string `json:"regency_code" gorm:"size:4"`
}
@@ -0,0 +1,79 @@
package practiceschedule
import (
ecore "simrs-vx/internal/domain/base-entities/core"
erx "simrs-vx/internal/domain/references/xtime"
)
type CreateDto struct {
Doctor_Id *uint `json:"doctor_id"`
Unit_Code *string `json:"unit_code"`
Day_Code *erx.DayCode `json:"day_code"`
StartTime *string `json:"startTime"`
EndTime *string `json:"endTime"`
}
type ReadListDto struct {
Doctor_Id *uint `json:"doctor_id"`
Unit_Code *string `json:"unit_code"`
Day_Code *erx.DayCode `json:"day_code"`
StartTime *string `json:"startTime"`
EndTime *string `json:"endTime"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Doctor_Id *uint `json:"doctor_id"`
Unit_Code *string `json:"unit_code"`
Day_Code *erx.DayCode `json:"day_code"`
StartTime *string `json:"startTime"`
EndTime *string `json:"endTime"`
}
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
Doctor_Id *uint `json:"doctor_id"`
Unit_Code *string `json:"unit_code"`
Day_Code *erx.DayCode `json:"day_code"`
StartTime *string `json:"startTime"`
EndTime *string `json:"endTime"`
}
func (d PracticeSchedule) ToResponse() ResponseDto {
resp := ResponseDto{
Doctor_Id: d.Doctor_Id,
Unit_Code: d.Unit_Code,
Day_Code: d.Day_Code,
StartTime: d.StartTime,
EndTime: d.EndTime,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []PracticeSchedule) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,19 @@
package practiceschedule
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/doctor"
eu "simrs-vx/internal/domain/main-entities/unit"
erx "simrs-vx/internal/domain/references/xtime"
)
type PracticeSchedule struct {
ecore.Main // adjust this according to the needs
Doctor_Id *uint `json:"doctor_id"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"`
Unit_Code *string `json:"unit_code"`
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
Day_Code *erx.DayCode `json:"day_code"`
StartTime *string `json:"startTime" gorm:"size:5"`
EndTime *string `json:"endTime" gorm:"size:5"`
}
@@ -0,0 +1,68 @@
package proceduresrc
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
IndName string `json:"indName"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
IndName string `json:"indName"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
IndName string `json:"indName"`
}
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"`
IndName string `json:"indName"`
}
func (d ProcedureSrc) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
IndName: d.IndName,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []ProcedureSrc) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,12 @@
package proceduresrc
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type ProcedureSrc struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:2048"`
IndName string `json:"indName" gorm:"size:2048"`
}
@@ -0,0 +1,59 @@
package province
type CreateDto struct {
Code string `json:"code" validate:"required;minLength=2;maxLength=2"`
Name string `json:"name" validate:"required;maxLength=10"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id int16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
}
type UpdateDto struct {
Id int16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id int16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
Id int16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
}
func (d Province) ToResponse() ResponseDto {
resp := ResponseDto{
Id: d.Id,
Code: d.Code,
Name: d.Name,
}
return resp
}
func ToResponseList(data []Province) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,10 @@
package province
import er "simrs-vx/internal/domain/main-entities/regency"
type Province struct {
Id int16 `json:"id" gorm:"primaryKey"`
Code string `json:"code" gorm:"unique;size:2"`
Name string `json:"name" gorm:"size:50"`
Regencies []*er.Regency `json:"regencies,omitempty" gorm:"foreignKey:Province_Code;references:Code"`
}
@@ -0,0 +1,62 @@
package regency
import ed "simrs-vx/internal/domain/main-entities/district"
type CreateDto struct {
Province_Code string `json:"province_code" validate:"numeric;maxLength=2"`
Code string `json:"code" validate:"numeric;maxLength=4"`
Name string `json:"name" validate:"alphaSpace;maxLength=50"`
}
type ReadListDto struct {
Province_Code string `json:"province_code"`
Code string `json:"code"`
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Province_Code string `json:"province_code"`
Code string `json:"code"`
Name string `json:"name"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
Id uint16 `json:"id"`
Province_Code string `json:"province_code"`
Code string `json:"code"`
Name string `json:"name"`
Districts []*ed.District `json:"districts,omitempty"`
}
func (d Regency) ToResponse() ResponseDto {
resp := ResponseDto(d)
return resp
}
func ToResponseList(data []Regency) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,11 @@
package regency
import ed "simrs-vx/internal/domain/main-entities/district"
type Regency struct {
Id uint16 `json:"id" gorm:"primaryKey"`
Province_Code string `json:"province_code" gorm:"size:2"`
Code string `json:"code" gorm:"unique;size:4"`
Name string `json:"name" gorm:"size:50"`
Districts []*ed.District `json:"districts,omitempty" gorm:"foreignKey:Regency_Code;references:Code"`
}
+73
View File
@@ -0,0 +1,73 @@
package unit
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ei "simrs-vx/internal/domain/main-entities/installation"
)
type CreateDto struct {
Installation_Id *uint16 `json:"installation_id"`
Code string `json:"code"`
Name string `json:"name"`
}
type ReadListDto struct {
Installation_Id *uint16 `json:"installation_id"`
Code string `json:"code"`
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Installation_Id *uint16 `json:"installation_id"`
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.SmallMain
Installation_Id *uint16 `json:"installation_id"`
Installation *ei.Installation
Code string `json:"code"`
Name string `json:"name"`
}
func (d Unit) ToResponse() ResponseDto {
resp := ResponseDto{
Installation_Id: d.Installation_Id,
Code: d.Code,
Name: d.Name,
}
resp.SmallMain = d.SmallMain
if d.Installation != nil {
resp.Installation = d.Installation
}
return resp
}
func ToResponseList(data []Unit) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,14 @@
package unit
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ei "simrs-vx/internal/domain/main-entities/installation"
)
type Unit struct {
ecore.SmallMain // adjust this according to the needs
Installation_Id *uint16 `json:"installation_id"`
Installation *ei.Installation `json:"installation" gorm:"foreignKey:Installation_Id"`
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
}
+63
View File
@@ -0,0 +1,63 @@
package uom
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
}
func (d Uom) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
}
resp.SmallMain = d.SmallMain
return resp
}
func ToResponseList(data []Uom) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,11 @@
package uom
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type Uom struct {
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
}
+51 -6
View File
@@ -1,6 +1,10 @@
package user
import erc "simrs-vx/internal/domain/references/common"
import (
ecore "simrs-vx/internal/domain/base-entities/core"
erc "simrs-vx/internal/domain/references/common"
"time"
)
type CreateDto struct {
Name string `json:"name"`
@@ -22,17 +26,58 @@ type ReadDetailDto struct {
Name string `json:"name"`
}
type Updatedto struct {
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type Deletedto struct {
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int64 `json:"count"`
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type LoginDto struct {
Name string `json:"name" validate:"required"`
Password string `json:"password" validate:"required"`
Duration uint32 `json:"duration"` // in minutes
}
type ResponseDto struct {
ecore.Main
Name string `json:"name"`
Status_Code erc.StatusCode `json:"status_code"`
FailedLoginCount uint8 `json:"failedLoginCount"`
LastSuccessLogin *time.Time `json:"lastSuccessLogin,omitempty"`
LastAllowdLogin *time.Time `json:"lastAllowdLogin,omitempty"`
}
func (d *User) ToResponse() ResponseDto {
resp := ResponseDto{
Name: d.Name,
Status_Code: d.Status_Code,
FailedLoginCount: d.FailedLoginCount,
LastSuccessLogin: d.LastSuccessLogin,
LastAllowdLogin: d.LastAllowdLogin,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []User) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
func (c CreateDto) Sanitize() CreateDto {
sanitized := c
sanitized.Password = "[REDACTED]"
return sanitized
}
+9 -5
View File
@@ -3,12 +3,16 @@ package user
import (
ecore "simrs-vx/internal/domain/base-entities/core"
erc "simrs-vx/internal/domain/references/common"
"time"
)
type User struct {
ecore.Main // adjust this according to the needs
Name string `json:"name" gorm:"not null;size:25"`
Password string `json:"password" gorm:"not null;size:255"`
Status_Code erc.StatusCode `json:"status_code" gorm:"not null;size:10"`
FailedLoginCount uint8 `json:"failedLoginCount" gorm:"type:smallint"`
ecore.Main // adjust this according to the needs
Name string `json:"name" gorm:"not null;size:25"`
Password string `json:"password" gorm:"not null;size:255"`
Status_Code erc.StatusCode `json:"status_code" gorm:"not null;size:10"`
FailedLoginCount uint8 `json:"failedLoginCount" gorm:"type:smallint"`
LoginAttemptCount int `json:"-"`
LastSuccessLogin *time.Time `json:"lastSuccessLogin,omitempty"`
LastAllowdLogin *time.Time `json:"lastAllowdLogin,omitempty"`
}
@@ -0,0 +1,59 @@
package village
type CreateDto struct {
District_Code string `json:"district_code" validate:"numeric;maxLength=6"`
Code string `json:"code" validate:"numeric;maxLength=10"`
Name string `json:"name" validate:"alphaSpace;maxLength=50"`
}
type ReadListDto struct {
District_Code string `json:"district_code"`
Code string `json:"code"`
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint32 `json:"id"`
District_Code string `json:"district_code"`
Code string `json:"code"`
Name string `json:"name"`
}
type UpdateDto struct {
Id uint32 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint32 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
Id uint32 `json:"id"`
District_Code string `json:"district_code"`
Code string `json:"code"`
Name string `json:"name"`
}
func (d Village) ToResponse() ResponseDto {
resp := ResponseDto(d)
return resp
}
func ToResponseList(data []Village) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,8 @@
package village
type Village struct {
Id uint32 `json:"id" gorm:"primaryKey"`
District_Code string `json:"district_code" gorm:"size:6"` // NOT: THE PROPER SIZE IS 6
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
}
@@ -0,0 +1,18 @@
package clinical
type (
CheckupScopeCode string
DoctorFeeTypeCode string
)
const (
CSCLab CheckupScopeCode = "lab" // Laboratorium
CSCMLab CheckupScopeCode = "mic-lab" // Microbacterial Laboratorium
CSCPLab CheckupScopeCode = "pa-lab" // Patology Anatomy Laboratorium
CSCRad CheckupScopeCode = "radiology" // Radiology
DFTCOut DoctorFeeTypeCode = "outpatient" // Rawat Jalan
DFTCInp DoctorFeeTypeCode = "inpatient" // Rawat Inap
DFTCEme DoctorFeeTypeCode = "emergency" // Darurat
DFTCReh DoctorFeeTypeCode = "medic-rehab" // Rehab Medik
)
+5 -2
View File
@@ -35,6 +35,9 @@ const (
)
const (
SCActive StatusCode = "active"
SCInactive StatusCode = "inactive"
SCNew StatusCode = "new"
SCActive StatusCode = "active"
SCInactive StatusCode = "inactive"
SCBlocked StatusCode = "blocked"
SCSuspended StatusCode = "suspended"
)
@@ -0,0 +1,45 @@
package encounter
type (
EncounterStatus string
EncounterClass string
EmergencyClass string
InpatientClass string
)
const (
EncounterStatusNew EncounterStatus = "new"
EncounterStatusNurse EncounterStatus = "nurse assessment"
EncounterStatusDoctor EncounterStatus = "doctor assessment"
EncounterStatusDone EncounterStatus = "done"
EncounterStatusCancel EncounterStatus = "canceled"
)
const (
IGD EmergencyClass = "igd"
Ponek EmergencyClass = "ponek"
)
const (
ECAmbulatory EncounterClass = "ambulatory"
ECOutpatient EncounterClass = "outpatient"
ECInpatient EncounterClass = "inpatient"
ECEmergency EncounterClass = "emergency"
ECRadiology EncounterClass = "radiology"
)
func (ec EncounterClass) Code() string {
switch ec {
case ECAmbulatory, ECOutpatient:
return "AMB"
case ECInpatient:
return "IMP"
case ECEmergency:
return "EMER"
default:
return "UNKNOWN"
}
}
const (
ICU InpatientClass = "ICU"
NonICU InpatientClass = "non ICU"
)
@@ -1,44 +0,0 @@
package examination
type (
ExaminationStatus string
ExaminationClass string
EmergencyClass string
InpatientClass string
)
const (
ExaminationStatusNew ExaminationStatus = "new"
ExaminationStatusNurse ExaminationStatus = "nurse assessment"
ExaminationStatusDoctor ExaminationStatus = "doctor assessment"
ExaminationStatusDone ExaminationStatus = "done"
ExaminationStatusCancel ExaminationStatus = "canceled"
)
const (
IGD EmergencyClass = "igd"
Ponek EmergencyClass = "ponek"
)
const (
ECAmbulatory ExaminationClass = "ambulatory"
ECInpatient ExaminationClass = "inpatient"
ECEmergency ExaminationClass = "emergency"
ECRadiology ExaminationClass = "radiology"
)
func (ec ExaminationClass) Code() string {
switch ec {
case ECAmbulatory:
return "AMB"
case ECInpatient:
return "IMP"
case ECEmergency:
return "EMER"
default:
return "UNKNOWN"
}
}
const (
ICU InpatientClass = "ICU"
NonICU InpatientClass = "non ICU"
)
@@ -1,46 +1,16 @@
package organization
type (
PositionCode string
QueuePositionCode string
EmployeePosisitionCode string
)
const (
PosReg PositionCode = "reg"
PosDoctor PositionCode = "doc"
PosNurse PositionCode = "nur" // DEPRECATED
PosAmbulatory PositionCode = "amb" // rawat jalan
PosEmergency PositionCode = "emg" // gawat darurat
PosNEC PositionCode = "eon" // ponek, cEONc
PosInpatient PositionCode = "inp" // rawat inap
PosICU PositionCode = "icu"
PosVK PositionCode = "vlk"
PosNeonatus PositionCode = "neo"
PosMidwife PositionCode = "mwf"
PosNutrition PositionCode = "nut"
PosAnesthesia PositionCode = "ans"
PosSurgery PositionCode = "sur"
PosPharmacy PositionCode = "pha"
PosRadiology PositionCode = "rad"
PosLab PositionCode = "lab"
PosFinance PositionCode = "fin"
PosHRD PositionCode = "hrd"
PosOperator PositionCode = "opr"
PosAdmin PositionCode = "adm"
PosSystem PositionCode = "sys"
)
const (
CQPCRegistration QueuePositionCode = "reg"
CQPCPayment QueuePositionCode = "pay"
CQPCExamination QueuePositionCode = "exa"
CQPCMedicine QueuePositionCode = "med"
CQPCProcedure QueuePositionCode = "pro"
CQPCFinish QueuePositionCode = "fin"
CQPCRegSkip QueuePositionCode = "reg-ski"
CQPCPaySkip QueuePositionCode = "pay-ski"
CQPCExaSkip QueuePositionCode = "exa-ski"
CQPCMedSkip QueuePositionCode = "med-ski"
CQPCReschedule QueuePositionCode = "rse"
EPCDoc EmployeePosisitionCode = "doctor"
EPCNur EmployeePosisitionCode = "nurse"
EPCNut EmployeePosisitionCode = "nutritionist"
EPCLab EmployeePosisitionCode = "laborant"
EPCPha EmployeePosisitionCode = "pharmacy"
EPCPay EmployeePosisitionCode = "payment"
EPCPav EmployeePosisitionCode = "payment-verificator"
EPCMan EmployeePosisitionCode = "management"
)
+49 -26
View File
@@ -6,17 +6,18 @@ type (
MaritalStatusCode string
ReligionCode string
EducationCode string
ProfessionCode string
OcupationCode string
AgeGroupCode string
AgeGroupForMedicineCode string
RelativeCode string
ContactTypeCode string
)
const (
GCMale GenderCode = "male"
GCFemale GenderCode = "female"
GCOther GenderCode = "other"
GCUnknown GenderCode = "unknown"
GCMale GenderCode = "male"
GCFemale GenderCode = "female"
GCNotStated GenderCode = "not-stated"
GCUnknown GenderCode = "unknown"
)
const (
@@ -44,7 +45,6 @@ const (
RCHindu ReligionCode = "hindu"
RCBudha ReligionCode = "budha"
RCKonghucu ReligionCode = "konghucu"
RCPenghayat ReligionCode = "penghayat"
)
const (
@@ -63,12 +63,14 @@ const (
)
const (
PCTidakBekerja ProfessionCode = "-"
PCPns ProfessionCode = "pns"
PCTniPolri ProfessionCode = "tni-polri"
PCBumn ProfessionCode = "bumn"
PCWiraswasta ProfessionCode = "wiraswasta"
PCLainlain ProfessionCode = "lainnya"
OCTidakBekerja OcupationCode = "tidak-bekerja"
OCPns OcupationCode = "pns"
OCTniPolisi OcupationCode = "polisi"
OCTni OcupationCode = "tni"
OCGuru OcupationCode = "guru"
OCWiraswasta OcupationCode = "wiraswasta"
OCKarySwasta OcupationCode = "kary-swasta"
OCLainlain OcupationCode = "lainnya"
)
const (
@@ -107,12 +109,19 @@ const (
RCMPamanNenek RelativeCode = "nenek"
)
const (
CTPhone ContactTypeCode = "phone"
CTMPhone ContactTypeCode = "m-phone"
CTEmail ContactTypeCode = "email"
CTFax ContactTypeCode = "fax"
)
func GetGenderCodes() map[GenderCode]string {
return map[GenderCode]string{
GCMale: "Laki-laki",
GCFemale: "Perempuan",
GCOther: "Lainnya",
GCUnknown: "Tidak diketahui",
GCMale: "Laki-laki",
GCFemale: "Perempuan",
GCNotStated: "Tidak disebutkan",
GCUnknown: "Tidak diketahui",
}
}
@@ -146,7 +155,6 @@ func GetReligionCodes() map[ReligionCode]string {
RCHindu: "Hindu",
RCBudha: "Budha",
RCKonghucu: "Konghucu",
RCPenghayat: "Penghayat",
}
}
@@ -167,14 +175,16 @@ func GetEducationCodes() map[EducationCode]string {
}
}
func GetProfessions() map[ProfessionCode]string {
return map[ProfessionCode]string{
PCTidakBekerja: "Tidak Bekerja",
PCPns: "PNS",
PCTniPolri: "TNI/POLRI",
PCBumn: "BUMN",
PCWiraswasta: "Pegawai Swasta / Wirausaha",
PCLainlain: "Lain-lain",
func GetProfessions() map[OcupationCode]string {
return map[OcupationCode]string{
OCTidakBekerja: "Tidak Bekerja",
OCPns: "PNS",
OCTniPolisi: "Polisi",
OCTni: "TNI",
OCGuru: "Guru",
OCWiraswasta: "Wiraswasta",
OCKarySwasta: "Kary Swasta",
OCLainlain: "Lain-lain",
}
}
@@ -220,6 +230,15 @@ func GetRelativeCodes() map[RelativeCode]string {
}
}
func GetContactTypeCodes() map[ContactTypeCode]string {
return map[ContactTypeCode]string{
CTPhone: "Telepon",
CTMPhone: "Telepon Seluler",
CTEmail: "Email",
CTFax: "Fax",
}
}
func (obj GenderCode) String() string {
return GetGenderCodes()[obj]
}
@@ -239,7 +258,7 @@ func (obj EducationCode) String() string {
return GetEducationCodes()[obj]
}
func (obj ProfessionCode) String() string {
func (obj OcupationCode) String() string {
return GetProfessions()[obj]
}
@@ -250,3 +269,7 @@ func (obj AgeGroupCode) String() string {
func (obj RelativeCode) String() string {
return GetRelativeCodes()[obj]
}
func (obj ContactTypeCode) String() string {
return GetContactTypeCodes()[obj]
}
@@ -0,0 +1,58 @@
package authentication
import (
"context"
"net/http"
d "github.com/karincake/dodol"
rw "github.com/karincake/risoles"
m "simrs-vx/internal/domain/main-entities/user"
s "simrs-vx/internal/use-case/main-use-case/authentication"
)
type authKey string
const akInfo authKey = "authInfo"
type AuthKey struct{}
// var Position m.Position
func Login(w http.ResponseWriter, r *http.Request) {
var input m.LoginDto
if !(rw.ValidateStructByIOR(w, r.Body, &input)) {
return
}
// input.Position = Position
res, err := s.GenToken(input)
if err != nil {
rw.WriteJSON(w, http.StatusUnauthorized, d.II{"errors": err}, nil)
} else {
rw.DataResponse(w, res, err)
}
}
func Logout(w http.ResponseWriter, r *http.Request) {
ctxVal := r.Context().Value(AuthKey{})
if ctxVal == nil {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "logout skiped. the request is done wihtout authorization."}, nil)
return
}
authInfo := ctxVal.(*s.AuthInfo)
s.RevokeToken(authInfo.Uuid)
rw.WriteJSON(w, http.StatusOK, d.IS{"message": "logged out"}, nil)
}
func GuardMW(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
accessDetail, err := s.ExtractToken(r, s.AccessToken)
if err != nil {
rw.WriteJSON(w, http.StatusUnauthorized, err.(d.FieldError), nil)
return
}
ctx := context.WithValue(r.Context(), AuthKey{}, accessDetail)
next.ServeHTTP(w, r.WithContext(ctx))
})
}
@@ -0,0 +1,71 @@
package counter
import (
"net/http"
rw "github.com/karincake/risoles"
sf "github.com/karincake/semprit"
// ua "github.com/karincake/tumpeng/auth/svc"
e "simrs-vx/internal/domain/main-entities/counter"
u "simrs-vx/internal/use-case/main-use-case/counter"
)
type myBase struct{}
var O myBase
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
dto := e.CreateDto{}
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return
}
res, err := u.Create(dto)
rw.DataResponse(w, res, err)
}
func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
dto := e.ReadListDto{}
sf.UrlQueryParam(&dto, *r.URL)
res, err := u.ReadList(dto)
rw.DataResponse(w, res, err)
}
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
return
}
dto := e.ReadDetailDto{}
dto.Id = uint16(id)
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 {
return
}
dto := e.UpdateDto{}
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return
}
dto.Id = uint16(id)
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 {
return
}
dto := e.DeleteDto{}
dto.Id = uint16(id)
res, err := u.Delete(dto)
rw.DataResponse(w, res, err)
}

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