feat/order-things: seperate mcu-order by scope

This commit is contained in:
2025-12-07 18:35:29 +07:00
parent faca8dfa14
commit b9e0d2beb0
14 changed files with 417 additions and 48 deletions
@@ -0,0 +1,23 @@
package apmcuorder
type CreateDto struct {
Encounter_Id uint `json:"encounter_id"`
Number uint64 `json:"number"`
Doctor_Code string `json:"-"`
Substances string `json:"substances"`
Fictations string `json:"fictations"`
Localization string `json:"localization"`
ClinicalDiagnoses string `json:"clinicalDiagnoses"`
Stadium string `json:"stadium"`
ClinicalNotes string `json:"clinicalNotes"`
CurrentHistory string `json:"currentHistory"`
PastHistory string `json:"pastHistory"`
PrevApMcu string `json:"prevApMcu"`
PrevApMcuNotes string `json:"prevApMcuNotes"`
SupportingExams string `json:"supportingExams"`
}
type UpdateDto struct {
Id uint64 `json:"id"`
CreateDto
}
@@ -0,0 +1,23 @@
package apmcuorder
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type ApMcuOrder struct {
ecore.BigMain
Encounter_Id uint `json:"encounter_id"`
Number uint64 `json:"number"`
Doctor_Code string `json:"doctor_code" gorm:"unique;size:20"`
Substances string `json:"substances"`
Fictations string `json:"fictations"`
Localization string `json:"localization"`
ClinicalDiagnoses string `json:"clinicalDiagnoses"`
Stadium string `json:"stadium"`
ClinicalNotes *string `json:"clinicalNotes"`
CurrentHistory string `json:"currentHistory"`
PastHistory string `json:"pastHistory"`
PrevApMcu *string `json:"prevApMcu"`
PrevApMcuNotes *string `json:"prevApMcuNotes"`
SupportingExams *string `json:"supportingExams"`
}
@@ -2,22 +2,13 @@ package apmcuorder
import (
ecore "simrs-vx/internal/domain/base-entities/core"
emo "simrs-vx/internal/domain/main-entities/mcu-order"
eamob "simrs-vx/internal/domain/main-entities/ap-mcu-order/base"
ed "simrs-vx/internal/domain/main-entities/doctor"
ee "simrs-vx/internal/domain/main-entities/encounter"
)
type CreateDto struct {
McuOrder_Id string `json:"mcuOrder_id"`
Substances string `json:"substances"`
Fictations string `json:"fictations"`
Localization string `json:"localization"`
ClinicalDiagnoses string `json:"clinicalDiagnoses"`
Stadium string `json:"stadium"`
ClinicalNotes string `json:"clinicalNotes"`
PastHistory string `json:"pastHistory"`
CurrentHistory string `json:"currentHistory"`
PrevApMcu string `json:"prevApMcu"`
PrevApMcuNotes string `json:"prevApMcuNotes"`
SupportingExams string `json:"supportingExams"`
eamob.CreateDto
}
type ReadListDto struct {
@@ -51,25 +42,32 @@ type MetaDto struct {
}
type ResponseDto struct {
ecore.Main
McuOrder_Id string `json:"mcuOrder_id"`
McuOrder *emo.McuOrder
Substances string `json:"substances"`
Fictations string `json:"fictations"`
Localization string `json:"localization"`
ClinicalDiagnoses string `json:"clinicalDiagnoses"`
Stadium string `json:"stadium"`
ClinicalNotes string `json:"clinicalNotes"`
PastHistory string `json:"pastHistory"`
CurrentHistory string `json:"currentHistory"`
PrevApMcu string `json:"prevApMcu"`
PrevApMcuNotes string `json:"prevApMcuNotes"`
SupportingExams string `json:"supportingExams"`
ecore.BigMain
Encounter_Id uint `json:"encounter_id"`
Encounter *ee.Encounter
Number uint64 `json:"number"`
Doctor_Code string `json:"doctor_code"`
Doctor *ed.Doctor
Substances string `json:"substances"`
Fictations string `json:"fictations"`
Localization string `json:"localization"`
ClinicalDiagnoses string `json:"clinicalDiagnoses"`
Stadium string `json:"stadium"`
ClinicalNotes *string `json:"clinicalNotes"`
PastHistory string `json:"pastHistory"`
CurrentHistory string `json:"currentHistory"`
PrevApMcu *string `json:"prevApMcu"`
PrevApMcuNotes *string `json:"prevApMcuNotes"`
SupportingExams *string `json:"supportingExams"`
}
func (d ApMcuOrder) ToResponse() ResponseDto {
resp := ResponseDto{
McuOrder_Id: d.McuOrder_Id,
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Number: d.Number,
Doctor_Code: d.Doctor_Code,
Doctor: d.Doctor,
Substances: d.Substances,
Fictations: d.Fictations,
Localization: d.Localization,
@@ -80,8 +78,9 @@ func (d ApMcuOrder) ToResponse() ResponseDto {
CurrentHistory: d.CurrentHistory,
PrevApMcu: d.PrevApMcu,
PrevApMcuNotes: d.PrevApMcuNotes,
SupportingExams: d.SupportingExams,
}
resp.McuOrder = d.McuOrder
resp.BigMain = d.BigMain
return resp
}
@@ -1,23 +1,13 @@
package apmcuorder
import (
ecore "simrs-vx/internal/domain/base-entities/core"
emo "simrs-vx/internal/domain/main-entities/mcu-order"
eamob "simrs-vx/internal/domain/main-entities/ap-mcu-order/base"
ed "simrs-vx/internal/domain/main-entities/doctor"
ee "simrs-vx/internal/domain/main-entities/encounter"
)
type ApMcuOrder struct {
ecore.BigMain
McuOrder_Id string `json:"mcuOrder_id" gorm:"unique;size:10"`
McuOrder *emo.McuOrder `json:"mcuOrder,omitempty" gorm:"foreignKey:McuOrder_Id;references:Id"`
Substances string `json:"substances"`
Fictations string `json:"fictations"`
Localization string `json:"localization"`
ClinicalDiagnoses string `json:"clinicalDiagnoses"`
Stadium string `json:"stadium"`
ClinicalNotes string `json:"clinicalNotes"`
PastHistory string `json:"pastHistory"`
CurrentHistory string `json:"currentHistory"`
PrevApMcu string `json:"prevApMcu"`
PrevApMcuNotes string `json:"prevApMcuNotes"`
SupportingExams string `json:"supportingExams"`
eamob.ApMcuOrder
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
}
@@ -0,0 +1,19 @@
package cpmcuorder
import (
"time"
ecore "simrs-vx/internal/domain/base-entities/core"
ercl "simrs-vx/internal/domain/references/clinical"
)
type CpMcuOrder struct {
ecore.BigMain
Encounter_Id uint `json:"encounter_id"`
Number uint64 `json:"number"`
Doctor_Code string `json:"doctor_code" gorm:"unique;size:20"`
UrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"urgencyLevel_code" gorm:"not null;size:15"`
OtherNotes *string `json:"otherNotes"`
ExamScheduleDate *time.Time `json:"examinationDate"`
Resume *string `json:"resume"`
}
@@ -0,0 +1,80 @@
package cpmcuorder
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"
)
type CreateDto struct {
Encounter_Id uint `json:"encounter_id" validate:"required"`
Number uint64 `json:"number"` // SHOULD BE AUTOMATIC WITHOUT SYNC
UrgencyLevel_Code string `json:"urgencyLevel_code" validate:"required"`
OtherNotes string `json:"otherNotes"`
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
type FilterDto struct {
Encounter_Id uint `json:"encounter-id"`
Doctor_Code string `json:"doctor-code"`
}
type ReadDetailDto struct {
Id uint64 `json:"id"`
}
type UpdateDto struct {
Id uint64 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint64 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.BigMain
Encounter_Id uint
Encounter *ee.Encounter
Number uint64 `json:"number"`
Doctor_Code string `json:"doctor_code"`
Doctor *ed.Doctor
UrgencyLevel_Code string `json:"urgencyLevel_code" gorm:"not null;size:15"`
OtherNotes *string `json:"otherNotes"`
Resume *string `json:"resume"`
}
func (d CpMcuOrder) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Number: d.Number,
Doctor_Code: d.Doctor_Code,
Doctor: d.Doctor,
UrgencyLevel_Code: string(d.UrgencyLevel_Code),
OtherNotes: d.OtherNotes,
Resume: d.Resume,
}
resp.BigMain = d.BigMain
return resp
}
func ToResponseList(data []CpMcuOrder) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,13 @@
package cpmcuorder
import (
eamob "simrs-vx/internal/domain/main-entities/cp-mcu-order/base"
ed "simrs-vx/internal/domain/main-entities/doctor"
ee "simrs-vx/internal/domain/main-entities/encounter"
)
type CpMcuOrder struct {
eamob.CpMcuOrder
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
}
@@ -0,0 +1,16 @@
package micromcuorder
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ercl "simrs-vx/internal/domain/references/clinical"
)
type MicroMcuOrder struct {
ecore.BigMain
Encounter_Id uint `json:"encounter_id"`
Number uint64 `json:"number"`
Doctor_Code string `json:"doctor_code" gorm:"unique;size:20"`
Stage_Code ercl.McuOrderStageCode `json:"stage_code" gorm:"not null;size:10"`
AxillaryTemp float64 `json:"axillaryTemp"`
OtherNotes *string `json:"otherNotes"`
}
@@ -0,0 +1,82 @@
package micromcuorder
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"
ercl "simrs-vx/internal/domain/references/clinical"
)
type CreateDto struct {
Encounter_Id uint `json:"encounter_id" validate:"required"`
Number uint64 `json:"number"` // SHOULD BE AUTOMATIC WITHOUT SYNC
OrderStage_Code string `json:"orderStage_code" gorm:"not null;size:10"`
AxillaryTemp float64 `json:"axillaryTemp"`
OtherNotes string `json:"otherNotes"`
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
type FilterDto struct {
Encounter_Id uint `json:"encounter-id"`
Doctor_Code string `json:"doctor-code"`
}
type ReadDetailDto struct {
Id uint64 `json:"id"`
}
type UpdateDto struct {
Id uint64 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint64 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.BigMain
Encounter_Id uint
Encounter *ee.Encounter
Number uint64 `json:"number"`
Doctor_Code string `json:"doctor_code"`
Doctor *ed.Doctor
Stage_Code ercl.McuOrderStageCode `json:"stage_code" gorm:"not null;size:10"`
AxillaryTemp float64 `json:"axillaryTemp"`
OtherNotes *string `json:"otherNotes"`
}
func (d MicroMcuOrder) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Number: d.Number,
Doctor_Code: d.Doctor_Code,
Doctor: d.Doctor,
Stage_Code: d.Stage_Code,
AxillaryTemp: d.AxillaryTemp,
OtherNotes: d.OtherNotes,
}
resp.BigMain = d.BigMain
return resp
}
func ToResponseList(data []MicroMcuOrder) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,13 @@
package micromcuorder
import (
ed "simrs-vx/internal/domain/main-entities/doctor"
ee "simrs-vx/internal/domain/main-entities/encounter"
eamob "simrs-vx/internal/domain/main-entities/micro-mcu-order/base"
)
type MicroMcuOrder struct {
eamob.MicroMcuOrder
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
}
@@ -0,0 +1,15 @@
package radiologymcuorder
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type RadiologyMcuOrder struct {
ecore.BigMain
Encounter_Id uint `json:"encounter_id"`
Number uint64 `json:"number"`
Doctor_Code string `json:"doctor_code" gorm:"unique;size:20"`
ClinicalNotes *string `json:"clinicalNotes"`
OtherNotes *string `json:"otherNotes"`
Resume *string `json:"resume"`
}
@@ -0,0 +1,84 @@
package radiologymcuorder
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"
ermoi "simrs-vx/internal/domain/main-entities/radiology-mcu-order-item/base"
)
type CreateDto struct {
Encounter_Id uint `json:"encounter_id"`
Number *uint64 `json:"number"` // SHOULD BE AUTOMATIC WITHOUT SYNC
Doctor_Code string `json:"-" validate:"required"`
ClinicalNotes string `json:"clinicalNotes"`
OtherNotes string `json:"otherNotes"`
Items []ermoi.SubCreateDto `json:"items" validate:"required"`
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
type FilterDto struct {
Encounter_Id uint `json:"encounter-id"`
Doctor_Code string `json:"doctor-code"`
}
type ReadDetailDto struct {
Id uint64 `json:"id"`
}
type UpdateDto struct {
Id uint64 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint64 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.BigMain
Encounter_Id uint `json:"encounter_id"`
Encounter *ee.Encounter
Number uint64 `json:"number"`
Doctor_Code string `json:"doctor_code"`
Doctor *ed.Doctor
ClinicalNotes *string `json:"clinicalNotes"`
OtherNotes *string `json:"otherNotes"`
Resume *string `json:"resume"`
Items []*ermoi.RadiologyMcuOrderItem
}
func (d RadiologyMcuOrder) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Number: d.Number,
Doctor_Code: d.Doctor_Code,
Doctor: d.Doctor,
ClinicalNotes: d.ClinicalNotes,
OtherNotes: d.OtherNotes,
Resume: d.Resume,
}
resp.BigMain = d.BigMain
return resp
}
func ToResponseList(data []RadiologyMcuOrder) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,15 @@
package radiologymcuorder
import (
ed "simrs-vx/internal/domain/main-entities/doctor"
ee "simrs-vx/internal/domain/main-entities/encounter"
ermoi "simrs-vx/internal/domain/main-entities/radiology-mcu-order-item/base"
eamob "simrs-vx/internal/domain/main-entities/radiology-mcu-order/base"
)
type RadiologyMcuOrder struct {
eamob.RadiologyMcuOrder
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
Items []*ermoi.RadiologyMcuOrderItem `json:"items" gorm:"foreignKey:RadiologyMcuOrder_Id;references:Id"`
}
@@ -17,14 +17,11 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.ApMcuOrder) {
inputSrc = &inputTemp.CreateDto
}
data.McuOrder_Id = inputSrc.McuOrder_Id
data.Substances = inputSrc.Substances
data.Fictations = inputSrc.Fictations
data.Localization = inputSrc.Localization
data.ClinicalDiagnoses = inputSrc.ClinicalDiagnoses
data.Stadium = inputSrc.Stadium
data.ClinicalNotes = inputSrc.ClinicalNotes
data.PastHistory = inputSrc.PastHistory
data.CurrentHistory = inputSrc.CurrentHistory
data.PrevApMcu = inputSrc.PrevApMcu
}