Merge branch 'migration' of github.com:dikstub-rssa/simrs-be into feat/patient
This commit is contained in:
No files matched your search
@@ -0,0 +1,13 @@
|
|||||||
|
-- Create "Patient" table
|
||||||
|
CREATE TABLE "public"."Patient" (
|
||||||
|
"Id" bigserial NOT NULL,
|
||||||
|
"CreatedAt" timestamptz NULL,
|
||||||
|
"UpdatedAt" timestamptz NULL,
|
||||||
|
"DeletedAt" timestamptz NULL,
|
||||||
|
"Person_Id" bigint NULL,
|
||||||
|
"RegisteredAt" timestamptz NULL,
|
||||||
|
"Status_Code" character varying(10) NOT NULL,
|
||||||
|
"Number" character varying(15) NULL,
|
||||||
|
PRIMARY KEY ("Id"),
|
||||||
|
CONSTRAINT "fk_Patient_Person" FOREIGN KEY ("Person_Id") REFERENCES "public"."Person" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||||
|
);
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
h1:xLrXCY32L4rM4g9bNhReT/a49v6gwYzJSNnzwSmFFlc=
|
h1:XRXWqXK7AhgwoDbOnYqWln74qQUn071LDRB7OmotZ5Y=
|
||||||
20250829081952.sql h1:YMsYq3uPsx70EjWSGfYnVRR5GV0q1fRGIszYZAWzXNo=
|
20250829081952.sql h1:YMsYq3uPsx70EjWSGfYnVRR5GV0q1fRGIszYZAWzXNo=
|
||||||
20250901073356.sql h1:jjd5TLs+Pyi0u3SrOM+aNTbHxSJboXgcOz/L4bkYx+c=
|
20250901073356.sql h1:jjd5TLs+Pyi0u3SrOM+aNTbHxSJboXgcOz/L4bkYx+c=
|
||||||
20250901080035.sql h1:LWa3X0NWjalVcxNbk5HaHj1Oqu60/AQabi0jBmCeQBI=
|
20250901080035.sql h1:LWa3X0NWjalVcxNbk5HaHj1Oqu60/AQabi0jBmCeQBI=
|
||||||
20250901105703.sql h1:2h2B/wOFM0826sBXQutTtq24C+5duLqi4zEFOdbPsCI=
|
20250901105703.sql h1:2h2B/wOFM0826sBXQutTtq24C+5duLqi4zEFOdbPsCI=
|
||||||
20250902052320.sql h1:+tWdeS4NorPj5WdKHMirBfP4EeS01wyyfdT03DBMmcI=
|
20250902052320.sql h1:+tWdeS4NorPj5WdKHMirBfP4EeS01wyyfdT03DBMmcI=
|
||||||
20250902063217.sql h1:ZDyL6lk12uFmboUCMfRTh5sfQ4wsC3bWSI+vAUFUiAA=
|
20250902063217.sql h1:wYFIrAIp1RczNvzlmu8jP8P1J7xEXqgDLKDUNBbkt84=
|
||||||
|
20250902105300.sql h1:5FRCQkxe/P97WwGJT05HsqLlOEbR9/BdWBY5wMSykYg=
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package patient
|
||||||
|
|
||||||
|
import (
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
ep "simrs-vx/internal/domain/main-entities/person"
|
||||||
|
epa "simrs-vx/internal/domain/main-entities/person-address"
|
||||||
|
epc "simrs-vx/internal/domain/main-entities/person-contact"
|
||||||
|
epr "simrs-vx/internal/domain/main-entities/person-relative"
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
ero "simrs-vx/internal/domain/references/organization"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreateDto struct {
|
||||||
|
Person_Id *uint `json:"-"`
|
||||||
|
Person *ep.UpdateDto `json:"person"`
|
||||||
|
PersonAddresses []epa.UpdateDto `json:"personAddresses"`
|
||||||
|
PersonContacts []epc.UpdateDto `json:"personContacts"`
|
||||||
|
PersonRelatives []epr.UpdateDto `json:"personRelatives"`
|
||||||
|
RegisteredAt *time.Time `json:"registeredAt"`
|
||||||
|
Status_Code erc.ActiveStatusCode `json:"status_code"`
|
||||||
|
Number *string `json:"number"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReadListDto struct {
|
||||||
|
FilterDto
|
||||||
|
Includes string `json:"includes"`
|
||||||
|
Preloads []string `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FilterDto struct {
|
||||||
|
Person_Id *uint `json:"person_id"`
|
||||||
|
Position_Code ero.EmployeePosisitionCode `json:"position_code"`
|
||||||
|
Division_Code *string `json:"division_code"`
|
||||||
|
RegisteredAt *time.Time `json:"registeredAt"`
|
||||||
|
Status_Code erc.ActiveStatusCode `json:"status_code"`
|
||||||
|
Number *string `json:"number"`
|
||||||
|
|
||||||
|
Page int `json:"page"`
|
||||||
|
PageSize int `json:"page_size"`
|
||||||
|
NoPagination int `json:"no_pagination"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReadDetailDto struct {
|
||||||
|
Id uint16 `json:"id"`
|
||||||
|
Person_Id *uint `json:"person_id"`
|
||||||
|
Number *string `json:"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
|
||||||
|
Person_Id *uint `json:"person_id"`
|
||||||
|
Person *ep.Person `json:"person,omitempty"`
|
||||||
|
RegisteredAt *time.Time `json:"registeredAt"`
|
||||||
|
Status_Code erc.ActiveStatusCode `json:"status_code"`
|
||||||
|
Number *string `json:"number"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d Patient) ToResponse() ResponseDto {
|
||||||
|
resp := ResponseDto{
|
||||||
|
Person_Id: d.Person_Id,
|
||||||
|
Person: d.Person,
|
||||||
|
RegisteredAt: d.RegisteredAt,
|
||||||
|
Status_Code: d.Status_Code,
|
||||||
|
Number: d.Number,
|
||||||
|
}
|
||||||
|
resp.Main = d.Main
|
||||||
|
return resp
|
||||||
|
}
|
||||||
|
|
||||||
|
func ToResponseList(data []Patient) []ResponseDto {
|
||||||
|
resp := make([]ResponseDto, len(data))
|
||||||
|
for i, u := range data {
|
||||||
|
resp[i] = u.ToResponse()
|
||||||
|
}
|
||||||
|
return resp
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package patient
|
||||||
|
|
||||||
|
import (
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
ep "simrs-vx/internal/domain/main-entities/person"
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Patient struct {
|
||||||
|
ecore.Main // adjust this according to the needs
|
||||||
|
Person_Id *uint `json:"person_id"`
|
||||||
|
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"`
|
||||||
|
RegisteredAt *time.Time `json:"registeredAt"`
|
||||||
|
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"`
|
||||||
|
Number *string `json:"number" gorm:"size:15"`
|
||||||
|
}
|
||||||
@@ -33,6 +33,7 @@ import (
|
|||||||
medicinemixitem "simrs-vx/internal/domain/main-entities/medicine-mix-item"
|
medicinemixitem "simrs-vx/internal/domain/main-entities/medicine-mix-item"
|
||||||
nurse "simrs-vx/internal/domain/main-entities/nurse"
|
nurse "simrs-vx/internal/domain/main-entities/nurse"
|
||||||
nutritionist "simrs-vx/internal/domain/main-entities/nutritionist"
|
nutritionist "simrs-vx/internal/domain/main-entities/nutritionist"
|
||||||
|
patient "simrs-vx/internal/domain/main-entities/patient"
|
||||||
person "simrs-vx/internal/domain/main-entities/person"
|
person "simrs-vx/internal/domain/main-entities/person"
|
||||||
personaddress "simrs-vx/internal/domain/main-entities/person-address"
|
personaddress "simrs-vx/internal/domain/main-entities/person-address"
|
||||||
personcontact "simrs-vx/internal/domain/main-entities/person-contact"
|
personcontact "simrs-vx/internal/domain/main-entities/person-contact"
|
||||||
@@ -123,6 +124,7 @@ func GetEntities() []any {
|
|||||||
&doctorfee.DoctorFee{},
|
&doctorfee.DoctorFee{},
|
||||||
&language.Language{},
|
&language.Language{},
|
||||||
&personrelative.PersonRelative{},
|
&personrelative.PersonRelative{},
|
||||||
|
&patient.Patient{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user