add soapi, sbar, adime, ambulatory, inpatient, emergency, appointment and edit encounter

This commit is contained in:
dpurbosakti
2025-09-08 13:26:36 +07:00
parent dd409e5c5e
commit d497b024dc
22 changed files with 876 additions and 89 deletions
@@ -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
);
@@ -0,0 +1,2 @@
-- Modify "Encounter" table
ALTER TABLE "public"."Encounter" DROP COLUMN "Assignment_Doctor_Id";
+3 -1
View File
@@ -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=
@@ -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
}
@@ -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"`
}
@@ -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
}
@@ -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"`
}
@@ -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
}
@@ -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"`
}
@@ -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
}
@@ -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"`
}
+82 -62
View File
@@ -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
@@ -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"`
}
@@ -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
}
@@ -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"`
}
+76
View File
@@ -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
}
@@ -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"`
}
@@ -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
}
@@ -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"`
}
@@ -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
@@ -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"
+14
View File
@@ -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{},
}
}