From 6b8f84efac8be32f9db72acfd4ce8cc324e3cf8f Mon Sep 17 00:00:00 2001 From: dpurbosakti Date: Wed, 17 Sep 2025 11:08:38 +0700 Subject: [PATCH] adjust on several order tables --- cmd/main-migration/migrations/20250917040616.sql | 8 ++++++++ cmd/main-migration/migrations/20250917040751.sql | 2 ++ cmd/main-migration/migrations/atlas.sum | 6 ++++-- .../main-entities/medication-item/entity.go | 2 ++ .../domain/main-entities/medicine-mix/entity.go | 5 +++-- .../main-entities/prescription-item/entity.go | 1 + .../domain/main-entities/prescription/entity.go | 16 ++++++++++------ 7 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 cmd/main-migration/migrations/20250917040616.sql create mode 100644 cmd/main-migration/migrations/20250917040751.sql diff --git a/cmd/main-migration/migrations/20250917040616.sql b/cmd/main-migration/migrations/20250917040616.sql new file mode 100644 index 00000000..71fc13e7 --- /dev/null +++ b/cmd/main-migration/migrations/20250917040616.sql @@ -0,0 +1,8 @@ +-- Modify "MedicationItem" table +ALTER TABLE "public"."MedicationItem" ADD COLUMN "Quantity" numeric NULL; +-- Modify "MedicineMix" table +ALTER TABLE "public"."MedicineMix" ADD COLUMN "Note" text NULL; +-- Modify "Prescription" table +ALTER TABLE "public"."Prescription" ADD COLUMN "Status_Code" text NULL; +-- Modify "PrescriptionItem" table +ALTER TABLE "public"."PrescriptionItem" ADD COLUMN "Quantity" numeric NULL; diff --git a/cmd/main-migration/migrations/20250917040751.sql b/cmd/main-migration/migrations/20250917040751.sql new file mode 100644 index 00000000..0b8f243b --- /dev/null +++ b/cmd/main-migration/migrations/20250917040751.sql @@ -0,0 +1,2 @@ +-- Modify "MedicationItem" table +ALTER TABLE "public"."MedicationItem" ADD COLUMN "Note" character varying(1024) NULL; diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index fcc26fdd..559bbade 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:lwrJz1Vor7muHsLHihYT704fcsjyX/JmBfRLfg+4PjI= +h1:1QSYLfLrRojOO3SUOR0bOUsv7hWGJxR4mfzv6/P540k= 20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= 20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= 20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= @@ -7,4 +7,6 @@ h1:lwrJz1Vor7muHsLHihYT704fcsjyX/JmBfRLfg+4PjI= 20250908073839.sql h1:cPk54xjLdMs26uY8ZHjNWLuyfAMzV7Zb0/9oJQrsw04= 20250910055902.sql h1:5xwjAV6QbtZT9empTJKfhyAjdknbHzb15B0Ku5dzqtQ= 20250915123412.sql h1:D83xaU2YlDEd21HLup/YQpQ2easMToYCyy/oK6AFgQs= -20250916043819.sql h1:qcON0PZq3bYL0dWZdDMHEvK9C7oH4JIMh5Il+RWA3UY= +20250916043819.sql h1:ekoTJsBqQZ8G8n0qJ03d13+eoNoc7sAUEQGA5D/CCxk= +20250917040616.sql h1:QFuMvZUCmZPWsjHTdIFOT8P0fzCv3/xP0jGsfVms0aA= +20250917040751.sql h1:/0YgGP0VLK/WGTVi1KUuPQsx7i9O9Em8u/Ec1luYPDo= diff --git a/internal/domain/main-entities/medication-item/entity.go b/internal/domain/main-entities/medication-item/entity.go index 671e96b3..e778cb50 100644 --- a/internal/domain/main-entities/medication-item/entity.go +++ b/internal/domain/main-entities/medication-item/entity.go @@ -22,4 +22,6 @@ type MedicationItem struct { Interval uint8 `json:"interval"` IntervalUnit_Code erc.TimeUnitCode `json:"intervalUnit_code"` IsRedeemed bool `json:"isRedeemed"` + Quantity float64 `json:"quantity"` + Note *string `json:"note" gorm:"size:1024"` } diff --git a/internal/domain/main-entities/medicine-mix/entity.go b/internal/domain/main-entities/medicine-mix/entity.go index 3670c6d6..2445bde2 100644 --- a/internal/domain/main-entities/medicine-mix/entity.go +++ b/internal/domain/main-entities/medicine-mix/entity.go @@ -5,6 +5,7 @@ import ( ) type MedicineMix struct { - ecore.Main // adjust this according to the needs - Name string `json:"name" gorm:"size:50"` + ecore.Main // adjust this according to the needs + Name string `json:"name" gorm:"size:50"` + Note *string `json:"note" gom:"size:1024"` } diff --git a/internal/domain/main-entities/prescription-item/entity.go b/internal/domain/main-entities/prescription-item/entity.go index 89537496..6ccf3ae4 100644 --- a/internal/domain/main-entities/prescription-item/entity.go +++ b/internal/domain/main-entities/prescription-item/entity.go @@ -21,4 +21,5 @@ type PrescriptionItem struct { Usage float64 `json:"usage"` Interval uint8 `json:"interval"` IntervalUnit_Code erc.TimeUnitCode `json:"intervalUnit_code"` + Quantity float64 `json:"quantity"` } diff --git a/internal/domain/main-entities/prescription/entity.go b/internal/domain/main-entities/prescription/entity.go index bf3e7930..da0554a9 100644 --- a/internal/domain/main-entities/prescription/entity.go +++ b/internal/domain/main-entities/prescription/entity.go @@ -4,14 +4,18 @@ import ( ecore "simrs-vx/internal/domain/base-entities/core" ed "simrs-vx/internal/domain/main-entities/doctor" ee "simrs-vx/internal/domain/main-entities/encounter" + "time" + + erc "simrs-vx/internal/domain/references/common" ) type Prescription 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"` - Doctor_Id *uint `json:"doctor_id"` - Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"` - IssuedAt *time.Time `json:"issuedAt"` + 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"` + Doctor_Id *uint `json:"doctor_id"` + Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"` + IssuedAt *time.Time `json:"issuedAt"` + Status_Code *erc.DataStatusCode `json:"status_code"` }