feat/things-munaja: device order items preload

This commit is contained in:
2025-11-15 01:16:21 +07:00
parent 824ecd88f5
commit c19965f4c3
3 changed files with 25 additions and 15 deletions
@@ -0,0 +1,14 @@
package base
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/device"
)
type DeviceOrderItem struct {
ecore.Main // adjust this according to the needs
DeviceOrder_Id *uint `json:"deviceOrder_id"`
Device_Code *string `json:"device_code"`
Device *ed.Device `json:"device,omitempty" gorm:"foreignKey:Device_Code;references:Code"`
Count uint8 `json:"count"`
}
@@ -1,16 +1,11 @@
package deviceorderitem
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/device"
edo "simrs-vx/internal/domain/main-entities/device-order"
eb "simrs-vx/internal/domain/main-entities/device-order-item/base"
)
type DeviceOrderItem struct {
ecore.Main // adjust this according to the needs
DeviceOrder_Id *uint `json:"deviceOrder_id"`
DeviceOrder *edo.DeviceOrder `json:"deviceOrder,omitempty" gorm:"foreignKey:DeviceOrder_Id;references:Id"`
Device_Code *string `json:"device_code"`
Device *ed.Device `json:"device,omitempty" gorm:"foreignKey:Device_Code;references:Code"`
Count uint8 `json:"count"`
eb.DeviceOrderItem
DeviceOrder *edo.DeviceOrder `json:"deviceOrder,omitempty" gorm:"foreignKey:DeviceOrder_Id;references:Id"`
}
@@ -2,19 +2,20 @@ package deviceorder
import (
ecore "simrs-vx/internal/domain/base-entities/core"
edoi "simrs-vx/internal/domain/main-entities/device-order-item/base"
ed "simrs-vx/internal/domain/main-entities/doctor"
ee "simrs-vx/internal/domain/main-entities/encounter"
erc "simrs-vx/internal/domain/references/common"
)
type DeviceOrder 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_Code *string `json:"doctor_code"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
Status_Code erc.DataStatusCode `json:"status_code"`
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_Code *string `json:"doctor_code"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
Status_Code erc.DataStatusCode `json:"status_code"`
Items []*edoi.DeviceOrderItem `json:"items" gorm:"foreignKey:DeviceOrder_Id;references:Id"`
}
func (d DeviceOrder) IsCompleted() bool {