add control-letter
This commit is contained in:
No files matched your search
@@ -0,0 +1,17 @@
|
|||||||
|
-- Create "ControlLetter" table
|
||||||
|
CREATE TABLE "public"."ControlLetter" (
|
||||||
|
"Id" bigserial NOT NULL,
|
||||||
|
"CreatedAt" timestamptz NULL,
|
||||||
|
"UpdatedAt" timestamptz NULL,
|
||||||
|
"DeletedAt" timestamptz NULL,
|
||||||
|
"Encounter_Id" bigint NULL,
|
||||||
|
"Unit_Id" bigint NULL,
|
||||||
|
"Specialist_Id" bigint NULL,
|
||||||
|
"Subspecialist_Id" bigint NULL,
|
||||||
|
"Date" timestamptz NULL,
|
||||||
|
PRIMARY KEY ("Id"),
|
||||||
|
CONSTRAINT "fk_ControlLetter_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||||
|
CONSTRAINT "fk_ControlLetter_Specialist" FOREIGN KEY ("Specialist_Id") REFERENCES "public"."Specialist" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||||
|
CONSTRAINT "fk_ControlLetter_Subspecialist" FOREIGN KEY ("Subspecialist_Id") REFERENCES "public"."Subspecialist" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||||
|
CONSTRAINT "fk_ControlLetter_Unit" FOREIGN KEY ("Unit_Id") REFERENCES "public"."Unit" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||||
|
);
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
h1:A+ajQZrPn+BR8s8J5tX9DrfLEzZbstFw0klWQiK5Nao=
|
h1:zJVjtCkiWEF41JV7lzbRtI5mPZGz5bC8FaVruh3fmkY=
|
||||||
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
||||||
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
||||||
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
||||||
@@ -63,4 +63,5 @@ h1:A+ajQZrPn+BR8s8J5tX9DrfLEzZbstFw0klWQiK5Nao=
|
|||||||
20251027075128.sql h1:/iFQBM1sytjqpyQSOx61q33gnorMgxTiFVSuL6bQqsM=
|
20251027075128.sql h1:/iFQBM1sytjqpyQSOx61q33gnorMgxTiFVSuL6bQqsM=
|
||||||
20251027091406.sql h1:eCZGtUkxAzEAqpC9UsGpP8Df9mS0DEOqSl885LgqpvM=
|
20251027091406.sql h1:eCZGtUkxAzEAqpC9UsGpP8Df9mS0DEOqSl885LgqpvM=
|
||||||
20251102002037.sql h1:lFJbuoZ2LMQnUNGdcwHVY3Xlfslgzu9t2WByT8yfOZI=
|
20251102002037.sql h1:lFJbuoZ2LMQnUNGdcwHVY3Xlfslgzu9t2WByT8yfOZI=
|
||||||
20251102091932.sql h1:QfMos5PVRvCsA427b505VSKxoFERhxx07DcP4WhSd7U=
|
20251102091932.sql h1:rmdhb5m+P+fU8jROBZNyeYgZKuQvucsuljXv4ZVzvks=
|
||||||
|
20251103081637.sql h1:jqpMnygFceOJn0rI30GYWI2CKbOu6RzVqw2/Pji2Ka8=
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package controlletter
|
||||||
|
|
||||||
|
import (
|
||||||
|
// std
|
||||||
|
"time"
|
||||||
|
|
||||||
|
// internal - lib
|
||||||
|
pa "simrs-vx/internal/lib/auth"
|
||||||
|
|
||||||
|
// internal - domain - base-entities
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
|
||||||
|
// internal - domain - main-entities
|
||||||
|
|
||||||
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||||
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||||
|
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||||
|
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreateDto struct {
|
||||||
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
|
Unit_Id *uint `json:"unit_id"`
|
||||||
|
Specialist_Id *uint `json:"specialist_id"`
|
||||||
|
Subspecialist_Id *uint `json:"subspecialist_id"`
|
||||||
|
Date *time.Time `json:"date"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReadListDto struct {
|
||||||
|
FilterDto
|
||||||
|
Includes string `json:"includes"`
|
||||||
|
Pagination ecore.Pagination
|
||||||
|
}
|
||||||
|
|
||||||
|
type FilterDto struct {
|
||||||
|
Encounter_Id *uint `json:"encounter-id"`
|
||||||
|
Unit_Id *uint `json:"unit-id"`
|
||||||
|
Specialist_Id *uint `json:"specialist-id"`
|
||||||
|
Subspecialist_Id *uint `json:"subspecialist-id"`
|
||||||
|
Date *time.Time `json:"date"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReadDetailDto struct {
|
||||||
|
Id uint16 `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateDto struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
CreateDto
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteDto struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyDto struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Solution *string `json:"solution"`
|
||||||
|
|
||||||
|
pa.AuthInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
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" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||||
|
Unit_Id *uint `json:"unit_id"`
|
||||||
|
Unit *eu.Unit `json:"unit" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||||
|
Specialist_Id *uint `json:"specialist_id"`
|
||||||
|
Specialist *es.Specialist `json:"specialist" gorm:"foreignKey:Specialist_Id;references:Id"`
|
||||||
|
Subspecialist_Id *uint `json:"subspecialist_id"`
|
||||||
|
Subspecialist *ess.Subspecialist `json:"subspecialist" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
||||||
|
Date *time.Time `json:"date"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d ControlLetter) ToResponse() ResponseDto {
|
||||||
|
resp := ResponseDto{
|
||||||
|
Encounter_Id: d.Encounter_Id,
|
||||||
|
Encounter: d.Encounter,
|
||||||
|
Unit_Id: d.Unit_Id,
|
||||||
|
Unit: d.Unit,
|
||||||
|
Specialist_Id: d.Specialist_Id,
|
||||||
|
Specialist: d.Specialist,
|
||||||
|
Subspecialist_Id: d.Subspecialist_Id,
|
||||||
|
Subspecialist: d.Subspecialist,
|
||||||
|
Date: d.Date,
|
||||||
|
}
|
||||||
|
resp.Main = d.Main
|
||||||
|
return resp
|
||||||
|
}
|
||||||
|
|
||||||
|
func ToResponseList(data []ControlLetter) []ResponseDto {
|
||||||
|
resp := make([]ResponseDto, len(data))
|
||||||
|
for i, u := range data {
|
||||||
|
resp[i] = u.ToResponse()
|
||||||
|
}
|
||||||
|
return resp
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package controlletter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||||
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||||
|
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||||
|
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ControlLetter struct {
|
||||||
|
ecore.Main // adjust this according to the needs
|
||||||
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
|
Encounter *ee.Encounter `json:"encounter" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||||
|
Unit_Id *uint `json:"unit_id"`
|
||||||
|
Unit *eu.Unit `json:"unit" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||||
|
Specialist_Id *uint `json:"specialist_id"`
|
||||||
|
Specialist *es.Specialist `json:"specialist" gorm:"foreignKey:Specialist_Id;references:Id"`
|
||||||
|
Subspecialist_Id *uint `json:"subspecialist_id"`
|
||||||
|
Subspecialist *ess.Subspecialist `json:"subspecialist" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
||||||
|
Date *time.Time `json:"date"`
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
appointment "simrs-vx/internal/domain/main-entities/appointment"
|
appointment "simrs-vx/internal/domain/main-entities/appointment"
|
||||||
chemo "simrs-vx/internal/domain/main-entities/chemo"
|
chemo "simrs-vx/internal/domain/main-entities/chemo"
|
||||||
consultation "simrs-vx/internal/domain/main-entities/consultation"
|
consultation "simrs-vx/internal/domain/main-entities/consultation"
|
||||||
|
controlletter "simrs-vx/internal/domain/main-entities/control-letter"
|
||||||
counter "simrs-vx/internal/domain/main-entities/counter"
|
counter "simrs-vx/internal/domain/main-entities/counter"
|
||||||
deathcause "simrs-vx/internal/domain/main-entities/death-cause"
|
deathcause "simrs-vx/internal/domain/main-entities/death-cause"
|
||||||
device "simrs-vx/internal/domain/main-entities/device"
|
device "simrs-vx/internal/domain/main-entities/device"
|
||||||
@@ -193,5 +194,6 @@ func getMainEntities() []any {
|
|||||||
&responsibledoctorhist.ResponsibleDoctorHist{},
|
&responsibledoctorhist.ResponsibleDoctorHist{},
|
||||||
&admemployeehist.AdmEmployeeHist{},
|
&admemployeehist.AdmEmployeeHist{},
|
||||||
&vclaimmember.VclaimMember{},
|
&vclaimmember.VclaimMember{},
|
||||||
|
&controlletter.ControlLetter{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user