add chemoplans entity in chemo protocol

This commit is contained in:
vanilia
2025-12-06 04:20:40 +07:00
parent 5af1d5218c
commit d82e67ae5c
5 changed files with 9 additions and 11 deletions
@@ -0,0 +1,2 @@
-- Modify "ChemoPlan" table
ALTER TABLE "public"."ChemoPlan" DROP CONSTRAINT "fk_ChemoPlan_Protocol", ADD CONSTRAINT "fk_ChemoProtocol_ChemoPlans" FOREIGN KEY ("Protocol_Id") REFERENCES "public"."ChemoProtocol" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION;
+3 -2
View File
@@ -1,4 +1,4 @@
h1:2pGamYMy0LEZE7Du/0SEb8z5LrkmpNk199Yw0CJri+M=
h1:JgjOL5Bl+2zIlc2E1Lz/LhEJo/IGWouNe79ccswAcq8=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -144,4 +144,5 @@ h1:2pGamYMy0LEZE7Du/0SEb8z5LrkmpNk199Yw0CJri+M=
20251202160848.sql h1:Kd2/TziKSMezrt4XgbjQcYvY/Lo9rX0qw7/Lz0/oyKk=
20251202180207.sql h1:IHmSMIO3ia+YV5GULixbdlV1joaUAWtnjQHPd8+HKiM=
20251202231005.sql h1:lua0KKoeBptSfs/6ehZE6Azo6YUlNkOJwGFyb1HQWkY=
20251205073858.sql h1:GD692c2jC2mFr6esv3eQmxEpWOeIA860TGctwHAldfM=
20251205073858.sql h1:Ep03jQ9hJAJILDJfKVcmi3Z6fqmTHSq9gKQtwf070PE=
20251205211957.sql h1:RGkuUdSgt8BtypqGpji9VBBi1r85e2ez1aJILTB7zi0=
@@ -1,18 +1,17 @@
package chemo_plan
import (
ecp "simrs-vx/internal/domain/main-entities/chemo-protocol"
ere "simrs-vx/internal/domain/references/encounter"
// std
"time"
ere "simrs-vx/internal/domain/references/encounter"
// internal - domain - main-entities
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Parent_Id *uint `json:"parent_id"`
Protocol_Id *uint `json:"protocol_id"`
SeriesNumber *uint16 `json:"seriesNumber"`
CycleNumber *uint `json:"cycleNumber"`
PlanDate *time.Time `json:"planDate"`
@@ -56,7 +55,6 @@ type ResponseDto struct {
ecore.Main
Parent_Id *uint `json:"parent_id"` // chemo.Id
Protocol_Id *uint `json:"protocol_id"`
Protocol ecp.ChemoProtocol `json:"protocol,omitempty"`
SeriesNumber *uint16 `json:"seriesNumber"` // series ke -
CycleNumber *uint `json:"cycleNumber"` // cycle ke -
PlanDate *time.Time `json:"planDate"`
@@ -68,8 +66,6 @@ type ResponseDto struct {
func (d ChemoPlan) ToResponse() ResponseDto {
resp := ResponseDto{
Parent_Id: d.Parent_Id,
Protocol_Id: d.Protocol_Id,
Protocol: d.Protocol,
SeriesNumber: d.SeriesNumber,
CycleNumber: d.CycleNumber,
PlanDate: d.PlanDate,
@@ -6,15 +6,12 @@ import (
ecore "simrs-vx/internal/domain/base-entities/core"
ere "simrs-vx/internal/domain/references/encounter"
ecp "simrs-vx/internal/domain/main-entities/chemo-protocol"
)
type ChemoPlan struct {
ecore.Main
Parent_Id *uint `json:"parent_id"` // chemo.Id
Protocol_Id *uint `json:"protocol_id"`
Protocol ecp.ChemoProtocol `json:"protocol,omitempty" gorm:"foreignKey:Protocol_Id;references:Id"`
SeriesNumber *uint16 `json:"seriesNumber"` // series ke -
CycleNumber *uint `json:"cycleNumber"` // cycle ke -
PlanDate *time.Time `json:"planDate"`
@@ -7,6 +7,7 @@ import (
erc "simrs-vx/internal/domain/references/common"
ec "simrs-vx/internal/domain/main-entities/chemo"
ecp "simrs-vx/internal/domain/main-entities/chemo-plan"
)
type ChemoProtocol struct {
@@ -24,4 +25,5 @@ type ChemoProtocol struct {
StartDate *time.Time `json:"startDate"`
EndDate *time.Time `json:"endDate"`
Status_Code erc.DataVerifiedCode `json:"status_code"`
ChemoPlans *[]ecp.ChemoPlan `json:"chemoPlans,omitempty" gorm:"foreignKey:Protocol_Id;references:Id"`
}