From d497b024dc84b0544dae04fed39fadf67dc98446 Mon Sep 17 00:00:00 2001 From: dpurbosakti Date: Mon, 8 Sep 2025 13:26:36 +0700 Subject: [PATCH] add soapi, sbar, adime, ambulatory, inpatient, emergency, appointment and edit encounter --- cmd/migration/migrations/20250908062237.sql | 96 ++++++++++++ cmd/migration/migrations/20250908062323.sql | 2 + cmd/migration/migrations/atlas.sum | 4 +- internal/domain/main-entities/adime/dto.go | 76 +++++++++ internal/domain/main-entities/adime/entity.go | 18 +++ .../domain/main-entities/ambulatory/dto.go | 61 ++++++++ .../domain/main-entities/ambulatory/entity.go | 15 ++ .../domain/main-entities/appointment/dto.go | 88 +++++++++++ .../main-entities/appointment/entity.go | 21 +++ .../domain/main-entities/emergency/dto.go | 61 ++++++++ .../domain/main-entities/emergency/entity.go | 15 ++ .../domain/main-entities/encounter/dto.go | 144 ++++++++++-------- .../domain/main-entities/encounter/entity.go | 43 +++--- .../domain/main-entities/inpatient/dto.go | 72 +++++++++ .../domain/main-entities/inpatient/entity.go | 18 +++ internal/domain/main-entities/sbar/dto.go | 76 +++++++++ internal/domain/main-entities/sbar/entity.go | 18 +++ internal/domain/main-entities/soapi/dto.go | 76 +++++++++ internal/domain/main-entities/soapi/entity.go | 18 +++ .../domain/references/clinical/clinical.go | 4 + .../domain/references/encounter/encounter.go | 25 ++- internal/interface/migration/migration.go | 14 ++ 22 files changed, 876 insertions(+), 89 deletions(-) create mode 100644 cmd/migration/migrations/20250908062237.sql create mode 100644 cmd/migration/migrations/20250908062323.sql create mode 100644 internal/domain/main-entities/adime/dto.go create mode 100644 internal/domain/main-entities/adime/entity.go create mode 100644 internal/domain/main-entities/ambulatory/dto.go create mode 100644 internal/domain/main-entities/ambulatory/entity.go create mode 100644 internal/domain/main-entities/appointment/dto.go create mode 100644 internal/domain/main-entities/appointment/entity.go create mode 100644 internal/domain/main-entities/emergency/dto.go create mode 100644 internal/domain/main-entities/emergency/entity.go create mode 100644 internal/domain/main-entities/inpatient/dto.go create mode 100644 internal/domain/main-entities/inpatient/entity.go create mode 100644 internal/domain/main-entities/sbar/dto.go create mode 100644 internal/domain/main-entities/sbar/entity.go create mode 100644 internal/domain/main-entities/soapi/dto.go create mode 100644 internal/domain/main-entities/soapi/entity.go diff --git a/cmd/migration/migrations/20250908062237.sql b/cmd/migration/migrations/20250908062237.sql new file mode 100644 index 00000000..cc509de4 --- /dev/null +++ b/cmd/migration/migrations/20250908062237.sql @@ -0,0 +1,96 @@ +-- Create "Appointment" table +CREATE TABLE "public"."Appointment" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "PracticeSchedule_Id" bigint NULL, + "Patient_Id" bigint NULL, + "Person_ResidentIdentityNumber" character varying(16) NULL, + "Person_Name" character varying(100) NULL, + "Person_PhoneNumber" character varying(30) NULL, + "PaymentMethod_Code" character varying(10) NULL, + "RefNumber" character varying(20) NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "fk_Appointment_Patient" FOREIGN KEY ("Patient_Id") REFERENCES "public"."Patient" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT "fk_Appointment_PracticeSchedule" FOREIGN KEY ("PracticeSchedule_Id") REFERENCES "public"."PracticeSchedule" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION +); +-- Modify "Encounter" table +ALTER TABLE "public"."Encounter" ADD COLUMN "Appointment_Doctor_Id" bigint NULL, ADD COLUMN "Appointment_Id" bigint NULL, ADD COLUMN "EarlyEducation" text NULL, ADD COLUMN "MedicalDischargeEducation" text NULL, ADD COLUMN "AdmDischargeEducation" text NULL, ADD COLUMN "DischargeReason" text NULL, ADD CONSTRAINT "fk_Encounter_Appointment" FOREIGN KEY ("Appointment_Id") REFERENCES "public"."Appointment" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Encounter_Appointment_Doctor" FOREIGN KEY ("Appointment_Doctor_Id") REFERENCES "public"."Doctor" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION; +-- Create "Adime" table +CREATE TABLE "public"."Adime" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Encounter_Id" bigint NULL, + "Employee_Id" bigint NULL, + "Time" timestamptz NULL, + "Value" text NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "fk_Adime_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT "fk_Adime_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION +); +-- Create "Ambulatory" table +CREATE TABLE "public"."Ambulatory" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Encounter_Id" bigint NULL, + "Class_Code" character varying(10) NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "fk_Ambulatory_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION +); +-- Create "Emergency" table +CREATE TABLE "public"."Emergency" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Encounter_Id" bigint NULL, + "Class_Code" character varying(10) NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "fk_Emergency_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION +); +-- Create "Inpatient" table +CREATE TABLE "public"."Inpatient" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Encounter_Id" bigint NULL, + "Class_Code" character varying(10) NULL, + "Infra_Id" integer NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "fk_Inpatient_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT "fk_Inpatient_Infra" FOREIGN KEY ("Infra_Id") REFERENCES "public"."Infra" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION +); +-- Create "Sbar" table +CREATE TABLE "public"."Sbar" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Encounter_Id" bigint NULL, + "Employee_Id" bigint NULL, + "Time" timestamptz NULL, + "Value" text NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "fk_Sbar_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT "fk_Sbar_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION +); +-- Create "Soapi" table +CREATE TABLE "public"."Soapi" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Encounter_Id" bigint NULL, + "Employee_Id" bigint NULL, + "Time" timestamptz NULL, + "Value" text NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "fk_Soapi_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT "fk_Soapi_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION +); diff --git a/cmd/migration/migrations/20250908062323.sql b/cmd/migration/migrations/20250908062323.sql new file mode 100644 index 00000000..cc63543f --- /dev/null +++ b/cmd/migration/migrations/20250908062323.sql @@ -0,0 +1,2 @@ +-- Modify "Encounter" table +ALTER TABLE "public"."Encounter" DROP COLUMN "Assignment_Doctor_Id"; diff --git a/cmd/migration/migrations/atlas.sum b/cmd/migration/migrations/atlas.sum index 10859e9b..91349cd8 100644 --- a/cmd/migration/migrations/atlas.sum +++ b/cmd/migration/migrations/atlas.sum @@ -1,3 +1,5 @@ -h1:G2T3Gv3jMXqZDaBw/lSU8IhowMI3z//r+ZtHxndsLc4= +h1:qEdw2cOowYcLvkC4fcOTQr2KqQIaZa6YYIgj2CgYbkM= 20250904105930.sql h1:Vv4vCurl7m7/ZB6TjRpkubHpQ4RYwSUn0QHdzfoGpzY= 20250904141448.sql h1:FYCHH9Os4KkrZMDu/jR8FMP+wLMRW+Mb0PkLU/9BRDg= +20250908062237.sql h1:oanBpKZd+akPu2I/xYhUSbd0G5tAFbXzKLER/Zs8ENI= +20250908062323.sql h1:miNG9COddXkD1jGTgaROMAZ618eT6oiLGiJhXWnQwhE= diff --git a/internal/domain/main-entities/adime/dto.go b/internal/domain/main-entities/adime/dto.go new file mode 100644 index 00000000..7cbe3608 --- /dev/null +++ b/internal/domain/main-entities/adime/dto.go @@ -0,0 +1,76 @@ +package adime + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + eem "simrs-vx/internal/domain/main-entities/employee" + ee "simrs-vx/internal/domain/main-entities/encounter" + "time" +) + +type CreateDto struct { + Encounter_Id *uint `json:"encounter_id"` + Employee_Id *uint `json:"employee_id"` + Time *time.Time `json:"time"` + Value *string `json:"value"` +} + +type ReadListDto struct { + Encounter_Id *uint `json:"encounter_id"` + Employee_Id *uint `json:"employee_id"` + Time *time.Time `json:"time"` + Value *string `json:"value"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"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.Main + Encounter_Id *uint `json:"encounter_id"` + Encounter *ee.Encounter `json:"encounter,omitempty"` + Employee_Id *uint `json:"employee_id"` + Employee *eem.Employee `json:"employee,omitempty"` + Time *time.Time `json:"time"` + Value *string `json:"value"` +} + +func (d Adime) ToResponse() ResponseDto { + resp := ResponseDto{ + Encounter_Id: d.Encounter_Id, + Encounter: d.Encounter, + Employee_Id: d.Employee_Id, + Employee: d.Employee, + Time: d.Time, + Value: d.Value, + } + resp.Main = d.Main + return resp +} + +func ToResponseList(data []Adime) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/adime/entity.go b/internal/domain/main-entities/adime/entity.go new file mode 100644 index 00000000..35fa7276 --- /dev/null +++ b/internal/domain/main-entities/adime/entity.go @@ -0,0 +1,18 @@ +package adime + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + eem "simrs-vx/internal/domain/main-entities/employee" + ee "simrs-vx/internal/domain/main-entities/encounter" + "time" +) + +type Adime struct { + ecore.Main // adjust this according to the needs + Encounter_Id *uint `json:"encounter_id"` + Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"` + Employee_Id *uint `json:"employee_id"` + Employee *eem.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` + Time *time.Time `json:"time"` + Value *string `json:"value"` +} diff --git a/internal/domain/main-entities/ambulatory/dto.go b/internal/domain/main-entities/ambulatory/dto.go new file mode 100644 index 00000000..cc1eebdd --- /dev/null +++ b/internal/domain/main-entities/ambulatory/dto.go @@ -0,0 +1,61 @@ +package ambulatory + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ee "simrs-vx/internal/domain/main-entities/encounter" + ere "simrs-vx/internal/domain/references/encounter" +) + +type CreateDto struct { + Encounter_Id *uint `json:"encounter_id"` + Class_Code ere.AmbulatoryClassCode `json:"class_code" validate:"maxLength=10"` +} + +type ReadListDto struct { + Encounter_Id *uint `json:"encounter_id"` + Class_Code ere.AmbulatoryClassCode `json:"class_code"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"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.Main + Encounter_Id *uint `json:"encounter_id"` + Encounter *ee.Encounter `json:"encounter,omitempty"` + Class_Code ere.AmbulatoryClassCode `json:"class_code"` +} + +func (d Ambulatory) ToResponse() ResponseDto { + resp := ResponseDto{} + resp.Main = d.Main + return resp +} + +func ToResponseList(data []Ambulatory) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/ambulatory/entity.go b/internal/domain/main-entities/ambulatory/entity.go new file mode 100644 index 00000000..58a9810e --- /dev/null +++ b/internal/domain/main-entities/ambulatory/entity.go @@ -0,0 +1,15 @@ +package ambulatory + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ee "simrs-vx/internal/domain/main-entities/encounter" + + ere "simrs-vx/internal/domain/references/encounter" +) + +type Ambulatory struct { + ecore.Main // adjust this according to the needs + Encounter_Id *uint `json:"encounter_id"` + Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"` + Class_Code ere.AmbulatoryClassCode `json:"class_code" gorm:"size:10"` +} diff --git a/internal/domain/main-entities/appointment/dto.go b/internal/domain/main-entities/appointment/dto.go new file mode 100644 index 00000000..ff91ae92 --- /dev/null +++ b/internal/domain/main-entities/appointment/dto.go @@ -0,0 +1,88 @@ +package appointment + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ep "simrs-vx/internal/domain/main-entities/patient" + eps "simrs-vx/internal/domain/main-entities/practice-schedule" + erc "simrs-vx/internal/domain/references/common" +) + +type CreateDto struct { + PracticeSchedule_Id *uint `json:"practiceSchedule_id"` + Patient_Id *uint `json:"patient_id"` + Person_ResidentIdentityNumber string `json:"person_residentIdentityNumber"` + Person_Name string `json:"person_name"` + Person_PhoneNumber string `json:"person_phoneNumber"` + PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code"` + RefNumber string `json:"refNumber"` +} + +type ReadListDto struct { + PracticeSchedule_Id *uint `json:"practiceSchedule_id"` + Patient_Id *uint `json:"patient_id"` + Person_ResidentIdentityNumber string `json:"person_residentIdentityNumber"` + Person_Name string `json:"person_name"` + Person_PhoneNumber string `json:"person_phoneNumber"` + PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code"` + RefNumber string `json:"refNumber"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"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.Main + PracticeSchedule_Id *uint `json:"practiceSchedule_id"` + PracticeSchedule *eps.PracticeSchedule `json:"practiceSchedule,omitempty"` + Patient_Id *uint `json:"patient_id"` + Patient *ep.Patient `json:"patient,omitempty"` + Person_ResidentIdentityNumber string `json:"person_residentIdentityNumber"` + Person_Name string `json:"person_name"` + Person_PhoneNumber string `json:"person_phoneNumber"` + PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code"` + RefNumber string `json:"refNumber"` +} + +func (d Appointment) ToResponse() ResponseDto { + resp := ResponseDto{ + PracticeSchedule_Id: d.PracticeSchedule_Id, + PracticeSchedule: d.PracticeSchedule, + Patient_Id: d.Patient_Id, + Patient: d.Patient, + Person_ResidentIdentityNumber: d.Person_ResidentIdentityNumber, + Person_Name: d.Person_Name, + Person_PhoneNumber: d.Person_PhoneNumber, + PaymentMethod_Code: d.PaymentMethod_Code, + RefNumber: d.RefNumber, + } + resp.Main = d.Main + return resp +} + +func ToResponseList(data []Appointment) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/appointment/entity.go b/internal/domain/main-entities/appointment/entity.go new file mode 100644 index 00000000..fada15ac --- /dev/null +++ b/internal/domain/main-entities/appointment/entity.go @@ -0,0 +1,21 @@ +package appointment + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ep "simrs-vx/internal/domain/main-entities/patient" + eps "simrs-vx/internal/domain/main-entities/practice-schedule" + erc "simrs-vx/internal/domain/references/common" +) + +type Appointment struct { + ecore.Main // adjust this according to the needs + PracticeSchedule_Id *uint `json:"practiceSchedule_id"` + PracticeSchedule *eps.PracticeSchedule `json:"practiceSchedule,omitempty" gorm:"foreignKey:PracticeSchedule_Id;references:Id"` + Patient_Id *uint `json:"patient_id"` + Patient *ep.Patient `json:"patient,omitempty" gorm:"foreignKey:Patient_Id;references:Id"` + Person_ResidentIdentityNumber string `json:"person_residentIdentityNumber" gorm:"size:16"` + Person_Name string `json:"person_name" gorm:"size:100"` + Person_PhoneNumber string `json:"person_phoneNumber" gorm:"size:30"` + PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code" gorm:"size:10"` + RefNumber string `json:"refNumber" gorm:"size:20"` +} diff --git a/internal/domain/main-entities/emergency/dto.go b/internal/domain/main-entities/emergency/dto.go new file mode 100644 index 00000000..6f8d658b --- /dev/null +++ b/internal/domain/main-entities/emergency/dto.go @@ -0,0 +1,61 @@ +package emergency + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ee "simrs-vx/internal/domain/main-entities/encounter" + ere "simrs-vx/internal/domain/references/encounter" +) + +type CreateDto struct { + Encounter_Id *uint `json:"encounter_id"` + Class_Code ere.EmergencyClassCode `json:"class_code" validate:"maxLength=10"` +} + +type ReadListDto struct { + Encounter_Id *uint `json:"encounter_id"` + Class_Code ere.EmergencyClassCode `json:"class_code"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"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.Main + Encounter_Id *uint `json:"encounter_id"` + Encounter *ee.Encounter `json:"encounter,omitempty"` + Class_Code ere.EmergencyClassCode `json:"class_code"` +} + +func (d Emergency) ToResponse() ResponseDto { + resp := ResponseDto{} + resp.Main = d.Main + return resp +} + +func ToResponseList(data []Emergency) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/emergency/entity.go b/internal/domain/main-entities/emergency/entity.go new file mode 100644 index 00000000..1e6fb078 --- /dev/null +++ b/internal/domain/main-entities/emergency/entity.go @@ -0,0 +1,15 @@ +package emergency + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ee "simrs-vx/internal/domain/main-entities/encounter" + + ere "simrs-vx/internal/domain/references/encounter" +) + +type Emergency struct { + ecore.Main // adjust this according to the needs + Encounter_Id *uint `json:"encounter_id"` + Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"` + Class_Code ere.EmergencyClassCode `json:"class_code" gorm:"size:10"` +} diff --git a/internal/domain/main-entities/encounter/dto.go b/internal/domain/main-entities/encounter/dto.go index 49a3b987..d128ac51 100644 --- a/internal/domain/main-entities/encounter/dto.go +++ b/internal/domain/main-entities/encounter/dto.go @@ -2,6 +2,7 @@ package encounter import ( ecore "simrs-vx/internal/domain/base-entities/core" + ea "simrs-vx/internal/domain/main-entities/appointment" ed "simrs-vx/internal/domain/main-entities/doctor" ep "simrs-vx/internal/domain/main-entities/patient" es "simrs-vx/internal/domain/main-entities/specialist" @@ -12,18 +13,23 @@ import ( ) type CreateDto struct { - Patient_Id *uint `json:"patient_id"` - Patient *ep.Patient `json:"patient,omitempty"` - RegisteredAt *time.Time `json:"registeredAt"` - Class_Code ere.EncounterClassCode `json:"class_code" validate:"maxLength=10"` - Unit_Id *uint `json:"unit_id"` - Specialist_Id *uint16 `json:"specialist_id"` - Subspecialist_Id *uint16 `json:"subspecialist_id"` - VisitDate time.Time `json:"visitDate"` - Assignment_Doctor_Id *uint `json:"assignment_doctor_id"` - Responsible_Doctor_Id *uint `json:"responsible_doctor_id"` - DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" validate:"maxLength=10"` - RefSource_Name *string `json:"refSource_name" validate:"maxLength=100"` + Patient_Id *uint `json:"patient_id"` + Patient *ep.Patient `json:"patient,omitempty"` + RegisteredAt *time.Time `json:"registeredAt"` + Class_Code ere.EncounterClassCode `json:"class_code" validate:"maxLength=10"` + Unit_Id *uint `json:"unit_id"` + Specialist_Id *uint16 `json:"specialist_id"` + Subspecialist_Id *uint16 `json:"subspecialist_id"` + VisitDate time.Time `json:"visitDate"` + Assignment_Doctor_Id *uint `json:"assignment_doctor_id"` + Responsible_Doctor_Id *uint `json:"responsible_doctor_id"` + DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" validate:"maxLength=10"` + RefSource_Name *string `json:"refSource_name" validate:"maxLength=100"` + Appointment_Id *uint `json:"appointment_id"` + EarlyEducation *string `json:"earlyEducation"` + MedicalDischargeEducation *string `json:"medicalDischargeEducation"` + AdmDischargeEducation *string `json:"admDischargeEducation"` + DischargeReason *string `json:"dischargeReason"` } type ReadListDto struct { @@ -33,18 +39,23 @@ type ReadListDto struct { } type FilterDto struct { - Patient_Id *uint `json:"patient_id"` - Patient *ep.Patient `json:"patient,omitempty"` - RegisteredAt *time.Time `json:"registeredAt"` - Class_Code ere.EncounterClassCode `json:"class_code" validate:"maxLength=10"` - Unit_Id *uint `json:"unit_id"` - Specialist_Id *uint16 `json:"specialist_id"` - Subspecialist_Id *uint16 `json:"subspecialist_id"` - VisitDate time.Time `json:"visitDate"` - Assignment_Doctor_Id *uint `json:"assignment_doctor_id"` - Responsible_Doctor_Id *uint `json:"responsible_doctor_id"` - DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" validate:"maxLength=10"` - RefSource_Name *string `json:"refSource_name" validate:"maxLength=100"` + Patient_Id *uint `json:"patient_id"` + Patient *ep.Patient `json:"patient,omitempty"` + RegisteredAt *time.Time `json:"registeredAt"` + Class_Code ere.EncounterClassCode `json:"class_code" validate:"maxLength=10"` + Unit_Id *uint `json:"unit_id"` + Specialist_Id *uint16 `json:"specialist_id"` + Subspecialist_Id *uint16 `json:"subspecialist_id"` + VisitDate time.Time `json:"visitDate"` + Assignment_Doctor_Id *uint `json:"assignment_doctor_id"` + Responsible_Doctor_Id *uint `json:"responsible_doctor_id"` + DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" validate:"maxLength=10"` + RefSource_Name *string `json:"refSource_name" validate:"maxLength=100"` + Appointment_Id *uint `json:"appointment_id"` + EarlyEducation *string `json:"earlyEducation"` + MedicalDischargeEducation *string `json:"medicalDischargeEducation"` + AdmDischargeEducation *string `json:"admDischargeEducation"` + DischargeReason *string `json:"dischargeReason"` Page int `json:"page"` PageSize int `json:"page_size"` @@ -52,10 +63,7 @@ type FilterDto struct { } type ReadDetailDto struct { - Id uint16 `json:"id"` - Code string `json:"code"` - Name string `json:"name"` - Parent_Id *int16 `json:"parent_id"` + Id uint16 `json:"id"` } type UpdateDto struct { @@ -75,44 +83,56 @@ type MetaDto struct { type ResponseDto struct { ecore.Main - Patient_Id *uint `json:"patient_id"` - Patient *ep.Patient `json:"patient,omitempty"` - RegisteredAt *time.Time `json:"registeredAt"` - Class_Code ere.EncounterClassCode `json:"class_code"` - Unit_Id *uint `json:"unit_id"` - Specialist_Id *uint16 `json:"specialist_id"` - Specialist *es.Specialist `json:"specialist,omitempty"` - Subspecialist_Id *uint16 `json:"subspecialist_id"` - Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"` - Unit *eu.Unit `json:"unit,omitempty"` - VisitDate time.Time `json:"visitDate"` - Assignment_Doctor_Id *uint `json:"assignment_doctor_id"` - Assignment_Doctor *ed.Doctor `json:"assignment_doctor,omitempty"` - Responsible_Doctor_Id *uint `json:"responsible_doctor_id"` - Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty"` - DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code` - RefSource_Name *string `json:"refSource_name"` + Patient_Id *uint `json:"patient_id"` + Patient *ep.Patient `json:"patient,omitempty"` + RegisteredAt *time.Time `json:"registeredAt"` + Class_Code ere.EncounterClassCode `json:"class_code"` + Unit_Id *uint `json:"unit_id"` + Specialist_Id *uint16 `json:"specialist_id"` + Specialist *es.Specialist `json:"specialist,omitempty"` + Subspecialist_Id *uint16 `json:"subspecialist_id"` + Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"` + Unit *eu.Unit `json:"unit,omitempty"` + VisitDate time.Time `json:"visitDate"` + Appointment_Doctor_Id *uint `json:"assignment_doctor_id"` + Appointment_Doctor *ed.Doctor `json:"assignment_doctor,omitempty"` + Responsible_Doctor_Id *uint `json:"responsible_doctor_id"` + Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty"` + DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code"` + RefSource_Name *string `json:"refSource_name"` + Appointment_Id *uint `json:"appointment_id"` + Appointment *ea.Appointment `json:"appointment,omitempty"` + EarlyEducation *string `json:"earlyEducation"` + MedicalDischargeEducation *string `json:"medicalDischargeEducation"` + AdmDischargeEducation *string `json:"admDischargeEducation"` + DischargeReason *string `json:"dischargeReason"` } func (d Encounter) ToResponse() ResponseDto { resp := ResponseDto{ - Patient_Id: d.Patient_Id, - Patient: d.Patient, - RegisteredAt: d.RegisteredAt, - Class_Code: d.Class_Code, - Unit_Id: d.Unit_Id, - Unit: d.Unit, - Specialist_Id: d.Specialist_Id, - Specialist: d.Specialist, - Subspecialist_Id: d.Subspecialist_Id, - Subspecialist: d.Subspecialist, - VisitDate: d.VisitDate, - Assignment_Doctor_Id: d.Assignment_Doctor_Id, - Assignment_Doctor: d.Assignment_Doctor, - Responsible_Doctor_Id: d.Responsible_Doctor_Id, - Responsible_Doctor: d.Responsible_Doctor, - DischardeMethod_Code: d.DischardeMethod_Code, - RefSource_Name: d.RefSource_Name, + Patient_Id: d.Patient_Id, + Patient: d.Patient, + RegisteredAt: d.RegisteredAt, + Class_Code: d.Class_Code, + Unit_Id: d.Unit_Id, + Unit: d.Unit, + Specialist_Id: d.Specialist_Id, + Specialist: d.Specialist, + Subspecialist_Id: d.Subspecialist_Id, + Subspecialist: d.Subspecialist, + VisitDate: d.VisitDate, + Appointment_Doctor_Id: d.Appointment_Doctor_Id, + Appointment_Doctor: d.Appointment_Doctor, + Responsible_Doctor_Id: d.Responsible_Doctor_Id, + Responsible_Doctor: d.Responsible_Doctor, + DischardeMethod_Code: d.DischardeMethod_Code, + RefSource_Name: d.RefSource_Name, + Appointment_Id: d.Appointment_Id, + Appointment: d.Appointment, + EarlyEducation: d.EarlyEducation, + MedicalDischargeEducation: d.MedicalDischargeEducation, + AdmDischargeEducation: d.AdmDischargeEducation, + DischargeReason: d.DischargeReason, } resp.Main = d.Main return resp diff --git a/internal/domain/main-entities/encounter/entity.go b/internal/domain/main-entities/encounter/entity.go index 95d2cac7..91df9883 100644 --- a/internal/domain/main-entities/encounter/entity.go +++ b/internal/domain/main-entities/encounter/entity.go @@ -2,6 +2,7 @@ package encounter import ( ecore "simrs-vx/internal/domain/base-entities/core" + ea "simrs-vx/internal/domain/main-entities/appointment" ed "simrs-vx/internal/domain/main-entities/doctor" ep "simrs-vx/internal/domain/main-entities/patient" es "simrs-vx/internal/domain/main-entities/specialist" @@ -12,22 +13,28 @@ import ( ) type Encounter struct { - ecore.Main // adjust this according to the needs - Patient_Id *uint `json:"patient_id"` - Patient *ep.Patient `json:"patient,omitempty" gorm:"foreignKey:Patient_Id;references:Id"` - RegisteredAt *time.Time `json:"registeredAt"` - Class_Code ere.EncounterClassCode `json:"class_code" gorm:"not null;size:10"` - Unit_Id *uint `json:"unit_id"` - Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"` - Specialist_Id *uint16 `json:"specialist_id"` - Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"` - Subspecialist_Id *uint16 `json:"subspecialist_id"` - Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"` - VisitDate time.Time `json:"visitDate"` - Assignment_Doctor_Id *uint `json:"assignment_doctor_id"` - Assignment_Doctor *ed.Doctor `json:"assignment_doctor,omitempty" gorm:"foreignKey:Assignment_Doctor_Id;references:Id"` - Responsible_Doctor_Id *uint `json:"responsible_doctor_id"` - Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty" gorm:"foreignKey:Responsible_Doctor_Id;references:Id"` - DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" gorm:"size:10"` - RefSource_Name *string `json:"refSource_name" gorm:"size:100"` + ecore.Main // adjust this according to the needs + Patient_Id *uint `json:"patient_id"` + Patient *ep.Patient `json:"patient,omitempty" gorm:"foreignKey:Patient_Id;references:Id"` + RegisteredAt *time.Time `json:"registeredAt"` + Class_Code ere.EncounterClassCode `json:"class_code" gorm:"not null;size:10"` + Unit_Id *uint `json:"unit_id"` + Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"` + Specialist_Id *uint16 `json:"specialist_id"` + Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"` + Subspecialist_Id *uint16 `json:"subspecialist_id"` + Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"` + VisitDate time.Time `json:"visitDate"` + Appointment_Doctor_Id *uint `json:"appointment_doctor_id"` + Appointment_Doctor *ed.Doctor `json:"appointment_doctor,omitempty" gorm:"foreignKey:Appointment_Doctor_Id;references:Id"` + Responsible_Doctor_Id *uint `json:"responsible_doctor_id"` + Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty" gorm:"foreignKey:Responsible_Doctor_Id;references:Id"` + DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" gorm:"size:10"` + RefSource_Name *string `json:"refSource_name" gorm:"size:100"` + Appointment_Id *uint `json:"appointment_id"` + Appointment *ea.Appointment `json:"appointment,omitempty" gorm:"foreignKey:Appointment_Id;references:Id"` + EarlyEducation *string `json:"earlyEducation"` + MedicalDischargeEducation *string `json:"medicalDischargeEducation"` + AdmDischargeEducation *string `json:"admDischargeEducation"` + DischargeReason *string `json:"dischargeReason"` } diff --git a/internal/domain/main-entities/inpatient/dto.go b/internal/domain/main-entities/inpatient/dto.go new file mode 100644 index 00000000..ec3bc229 --- /dev/null +++ b/internal/domain/main-entities/inpatient/dto.go @@ -0,0 +1,72 @@ +package inpatient + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ee "simrs-vx/internal/domain/main-entities/encounter" + ei "simrs-vx/internal/domain/main-entities/infra" + ere "simrs-vx/internal/domain/references/encounter" +) + +type CreateDto struct { + Encounter_Id *uint `json:"encounter_id"` + Class_Code ere.InpatientClassCode `json:"class_code" validate:"maxLength=10"` + Infra_Id *uint16 `json:"infra_id"` +} + +type ReadListDto struct { + Encounter_Id *uint `json:"encounter_id"` + Class_Code ere.InpatientClassCode `json:"class_code"` + Infra_Id *uint16 `json:"infra_id"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"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.Main + Encounter_Id *uint `json:"encounter_id"` + Encounter *ee.Encounter `json:"encounter,omitempty"` + Class_Code ere.InpatientClassCode `json:"class_code"` + Infra_Id *uint16 `json:"infra_id"` + Infra *ei.Infra `json:"infra,omitempty"` +} + +func (d Inpatient) ToResponse() ResponseDto { + resp := ResponseDto{ + Encounter_Id: d.Encounter_Id, + Encounter: d.Encounter, + Class_Code: d.Class_Code, + Infra_Id: d.Infra_Id, + Infra: d.Infra, + } + resp.Main = d.Main + return resp +} + +func ToResponseList(data []Inpatient) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/inpatient/entity.go b/internal/domain/main-entities/inpatient/entity.go new file mode 100644 index 00000000..328f5d12 --- /dev/null +++ b/internal/domain/main-entities/inpatient/entity.go @@ -0,0 +1,18 @@ +package inpatient + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ee "simrs-vx/internal/domain/main-entities/encounter" + ei "simrs-vx/internal/domain/main-entities/infra" + + ere "simrs-vx/internal/domain/references/encounter" +) + +type Inpatient struct { + ecore.Main // adjust this according to the needs + Encounter_Id *uint `json:"encounter_id"` + Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"` + Class_Code ere.InpatientClassCode `json:"class_code" gorm:"size:10"` + Infra_Id *uint16 `json:"infra_id"` + Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"` +} diff --git a/internal/domain/main-entities/sbar/dto.go b/internal/domain/main-entities/sbar/dto.go new file mode 100644 index 00000000..3030b6d6 --- /dev/null +++ b/internal/domain/main-entities/sbar/dto.go @@ -0,0 +1,76 @@ +package sbar + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + eem "simrs-vx/internal/domain/main-entities/employee" + ee "simrs-vx/internal/domain/main-entities/encounter" + "time" +) + +type CreateDto struct { + Encounter_Id *uint `json:"encounter_id"` + Employee_Id *uint `json:"employee_id"` + Time *time.Time `json:"time"` + Value *string `json:"value"` +} + +type ReadListDto struct { + Encounter_Id *uint `json:"encounter_id"` + Employee_Id *uint `json:"employee_id"` + Time *time.Time `json:"time"` + Value *string `json:"value"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"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.Main + Encounter_Id *uint `json:"encounter_id"` + Encounter *ee.Encounter `json:"encounter,omitempty"` + Employee_Id *uint `json:"employee_id"` + Employee *eem.Employee `json:"employee,omitempty"` + Time *time.Time `json:"time"` + Value *string `json:"value"` +} + +func (d Sbar) ToResponse() ResponseDto { + resp := ResponseDto{ + Encounter_Id: d.Encounter_Id, + Encounter: d.Encounter, + Employee_Id: d.Employee_Id, + Employee: d.Employee, + Time: d.Time, + Value: d.Value, + } + resp.Main = d.Main + return resp +} + +func ToResponseList(data []Sbar) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/sbar/entity.go b/internal/domain/main-entities/sbar/entity.go new file mode 100644 index 00000000..62303f05 --- /dev/null +++ b/internal/domain/main-entities/sbar/entity.go @@ -0,0 +1,18 @@ +package sbar + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + eem "simrs-vx/internal/domain/main-entities/employee" + ee "simrs-vx/internal/domain/main-entities/encounter" + "time" +) + +type Sbar struct { + ecore.Main // adjust this according to the needs + Encounter_Id *uint `json:"encounter_id"` + Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"` + Employee_Id *uint `json:"employee_id"` + Employee *eem.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` + Time *time.Time `json:"time"` + Value *string `json:"value"` +} diff --git a/internal/domain/main-entities/soapi/dto.go b/internal/domain/main-entities/soapi/dto.go new file mode 100644 index 00000000..3e160cb2 --- /dev/null +++ b/internal/domain/main-entities/soapi/dto.go @@ -0,0 +1,76 @@ +package soapi + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + eem "simrs-vx/internal/domain/main-entities/employee" + ee "simrs-vx/internal/domain/main-entities/encounter" + "time" +) + +type CreateDto struct { + Encounter_Id *uint `json:"encounter_id"` + Employee_Id *uint `json:"employee_id"` + Time *time.Time `json:"time"` + Value *string `json:"value"` +} + +type ReadListDto struct { + Encounter_Id *uint `json:"encounter_id"` + Employee_Id *uint `json:"employee_id"` + Time *time.Time `json:"time"` + Value *string `json:"value"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"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.Main + Encounter_Id *uint `json:"encounter_id"` + Encounter *ee.Encounter `json:"encounter,omitempty"` + Employee_Id *uint `json:"employee_id"` + Employee *eem.Employee `json:"employee,omitempty"` + Time *time.Time `json:"time"` + Value *string `json:"value"` +} + +func (d Soapi) ToResponse() ResponseDto { + resp := ResponseDto{ + Encounter_Id: d.Encounter_Id, + Encounter: d.Encounter, + Employee_Id: d.Employee_Id, + Employee: d.Employee, + Time: d.Time, + Value: d.Value, + } + resp.Main = d.Main + return resp +} + +func ToResponseList(data []Soapi) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/soapi/entity.go b/internal/domain/main-entities/soapi/entity.go new file mode 100644 index 00000000..f6c6b5e9 --- /dev/null +++ b/internal/domain/main-entities/soapi/entity.go @@ -0,0 +1,18 @@ +package soapi + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + eem "simrs-vx/internal/domain/main-entities/employee" + ee "simrs-vx/internal/domain/main-entities/encounter" + "time" +) + +type Soapi struct { + ecore.Main // adjust this according to the needs + Encounter_Id *uint `json:"encounter_id"` + Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"` + Employee_Id *uint `json:"employee_id"` + Employee *eem.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` + Time *time.Time `json:"time"` + Value *string `json:"value"` +} diff --git a/internal/domain/references/clinical/clinical.go b/internal/domain/references/clinical/clinical.go index 3998811b..e5c85682 100644 --- a/internal/domain/references/clinical/clinical.go +++ b/internal/domain/references/clinical/clinical.go @@ -1,9 +1,11 @@ +// Package clinical mostly about SOAPI package clinical type ( SubjectCode string ObjectCode string AssessmentCode string + PlanCode string InstructionCode string ) @@ -31,6 +33,8 @@ const ( ACLateDiag AssessmentCode = "late-diag" // Diagnosis Akhir ACSecDiag AssessmentCode = "sec-diag" // Diagnosis Sekunder + PCPlan PlanCode = "plan" // Rencana + ICDetail InstructionCode = "detail" // Detail instruksi ICMedAct InstructionCode = "med-act" // Tindakan medis ICMedication InstructionCode = "medication" // Obat diff --git a/internal/domain/references/encounter/encounter.go b/internal/domain/references/encounter/encounter.go index 00b01236..68585f9e 100644 --- a/internal/domain/references/encounter/encounter.go +++ b/internal/domain/references/encounter/encounter.go @@ -9,17 +9,14 @@ type ( EmergencyClassCode string OutpatientClassCode string CheckupScopeCode string + AmbulatoryClassCode string + InpatientClassCode string ) const ( - ECOutpatient EncounterClassCode = "outpatient" ECAmbulatory EncounterClassCode = "ambulatory" ECEmergency EncounterClassCode = "emergency" ECInpatient EncounterClassCode = "inpatient" - ECDraft EncounterClassCode = "draft" - ECDone EncounterClassCode = "done" - ECCancel EncounterClassCode = "cancel" - ECSkip EncounterClassCode = "skip" QSCWait QueueStatusCode = "wait" // Tunggu QSCProc QueueStatusCode = "proc" // Proses @@ -27,8 +24,13 @@ const ( QSCCancel QueueStatusCode = "cancel" // Dibatalkan QSCSkip QueueStatusCode = "skip" // Dilewati - DMCHome DischargeMethodCode = "home" // Rumah - DMCHomeReq DischargeMethodCode = "home-request" // Rumah (Dibutuhkan) + DMCHome DischargeMethodCode = "home" // Rumah + DMCHomeReq DischargeMethodCode = "home-request" // Rumah (Dibutuhkan) + DMCConsulation DischargeMethodCode = "consulation" // Konsultasi Lanjutan + DMCInpatient DischargeMethodCode = "inpatient" // Inpatient + DMCExtRef DischargeMethodCode = "external-ref" // Rujuk Eksternal + DMCIntRef DischargeMethodCode = "internal-ref" // Rujuk Internal + DMCDeath DischargeMethodCode = "death" // Meninggal TCAmbulance TransportationCode = "ambulance" TCCar TransportationCode = "car" @@ -55,11 +57,18 @@ const ( CSCPLab CheckupScopeCode = "pa-lab" // Patology Anatomy Laboratorium CSCRad CheckupScopeCode = "radiology" // Radiology + ACCReg AmbulatoryClassCode = "reg" // Regular + ACCRme AmbulatoryClassCode = "rme" // Rehab Medik + + ICCIp InpatientClassCode = "ip" // Regular Rawat Inap + ICCICU InpatientClassCode = "icu" // ICU + ICCHCU InpatientClassCode = "hcu" // HCU + ICCVK InpatientClassCode = "vk" // Verlos kamer ) func (ec EncounterClassCode) Code() string { switch ec { - case ECAmbulatory, ECOutpatient: + case ECAmbulatory: return "AMB" case ECInpatient: return "IMP" diff --git a/internal/interface/migration/migration.go b/internal/interface/migration/migration.go index ee3cf1fc..990ca134 100644 --- a/internal/interface/migration/migration.go +++ b/internal/interface/migration/migration.go @@ -5,6 +5,9 @@ import ( "io" "os" "os/exec" + adime "simrs-vx/internal/domain/main-entities/adime" + ambulatory "simrs-vx/internal/domain/main-entities/ambulatory" + appointment "simrs-vx/internal/domain/main-entities/appointment" counter "simrs-vx/internal/domain/main-entities/counter" device "simrs-vx/internal/domain/main-entities/device" diagnosesrc "simrs-vx/internal/domain/main-entities/diagnose-src" @@ -13,10 +16,12 @@ import ( divisionposition "simrs-vx/internal/domain/main-entities/division-position" doctor "simrs-vx/internal/domain/main-entities/doctor" doctorfee "simrs-vx/internal/domain/main-entities/doctor-fee" + emergency "simrs-vx/internal/domain/main-entities/emergency" employee "simrs-vx/internal/domain/main-entities/employee" encounter "simrs-vx/internal/domain/main-entities/encounter" ethnic "simrs-vx/internal/domain/main-entities/ethnic" infra "simrs-vx/internal/domain/main-entities/infra" + inpatient "simrs-vx/internal/domain/main-entities/inpatient" installation "simrs-vx/internal/domain/main-entities/installation" insurancecompany "simrs-vx/internal/domain/main-entities/insurance-company" item "simrs-vx/internal/domain/main-entities/item" @@ -47,6 +52,8 @@ import ( province "simrs-vx/internal/domain/main-entities/province" regency "simrs-vx/internal/domain/main-entities/regency" room "simrs-vx/internal/domain/main-entities/room" + sbar "simrs-vx/internal/domain/main-entities/sbar" + soapi "simrs-vx/internal/domain/main-entities/soapi" specialist "simrs-vx/internal/domain/main-entities/specialist" specialistintern "simrs-vx/internal/domain/main-entities/specialist-intern" subspecialist "simrs-vx/internal/domain/main-entities/subspecialist" @@ -131,12 +138,19 @@ func GetEntities() []any { &language.Language{}, &personrelative.PersonRelative{}, &patient.Patient{}, + &appointment.Appointment{}, &encounter.Encounter{}, &laborant.Laborant{}, &specialist.Specialist{}, &subspecialist.Subspecialist{}, &specialistintern.SpecialistIntern{}, &room.Room{}, + &soapi.Soapi{}, + &sbar.Sbar{}, + &adime.Adime{}, + &emergency.Emergency{}, + &inpatient.Inpatient{}, + &ambulatory.Ambulatory{}, } }