feat (consultation): update column and adjust
This commit is contained in:
@@ -12,9 +12,10 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Case *string `json:"case" validate:"maxLength=2048"`
|
||||
Unit_Id *uint `json:"unit_id"`
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Date *time.Time `json:"date"`
|
||||
Problem *string `json:"problem" validate:"maxLength=10240"`
|
||||
DstUnit_Id *uint `json:"dstUnit_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -26,8 +27,8 @@ type ReadListDto struct {
|
||||
|
||||
type FilterDto struct {
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Unit_Id *uint `json:"unit_id"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
DstUnit_Id *uint `json:"dstUnit_id"`
|
||||
DstDoctor_Id *uint `json:"dstDoctor_id"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
@@ -60,12 +61,13 @@ type ResponseDto struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty"`
|
||||
Case *string `json:"case"`
|
||||
Date *time.Time `json:"date"`
|
||||
Problem *string `json:"problem"`
|
||||
Solution *string `json:"solution"`
|
||||
Unit_Id *uint `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty"`
|
||||
DstUnit_Id *uint `json:"dstUnit_id"`
|
||||
DstUnit *eu.Unit `json:"dstUnit,omitempty"`
|
||||
DstDoctor_Id *uint `json:"dstDoctor_id"`
|
||||
DstDoctor *ed.Doctor `json:"dstDoctor,omitempty"`
|
||||
RepliedAt *time.Time `json:"repliedAt"`
|
||||
}
|
||||
|
||||
@@ -73,13 +75,13 @@ func (d Consultation) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Encounter_Id: d.Encounter_Id,
|
||||
Encounter: d.Encounter,
|
||||
Case: d.Case,
|
||||
Date: d.Date,
|
||||
Problem: d.Problem,
|
||||
Solution: d.Solution,
|
||||
Unit_Id: d.Unit_Id,
|
||||
Unit: d.Unit,
|
||||
Doctor_Id: d.Doctor_Id,
|
||||
Doctor: d.Doctor,
|
||||
RepliedAt: d.RepliedAt,
|
||||
DstUnit_Id: d.DstUnit_Id,
|
||||
DstUnit: d.DstUnit,
|
||||
DstDoctor_Id: d.DstDoctor_Id,
|
||||
DstDoctor: d.DstDoctor,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -13,11 +13,13 @@ type Consultation 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"`
|
||||
Case *string `json:"case" gorm:"size:2048"`
|
||||
Solution *string `json:"solution" gorm:"size:2048"`
|
||||
Unit_Id *uint `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
Doctor *ed.Doctor `json:"doctor" gorm:"foreignKey:Doctor_Id;references:Id"`
|
||||
RepliedAt *time.Time `json:"repliedAt"`
|
||||
Date *time.Time `json:"date"`
|
||||
|
||||
Problem *string `json:"case" gorm:"size:10240"`
|
||||
Solution *string `json:"solution" gorm:"size:10240"`
|
||||
DstUnit_Id *uint `json:"dstUnit_id"`
|
||||
DstUnit *eu.Unit `json:"dstUnit" gorm:"foreignKey:DstUnit_Id;references:Id"`
|
||||
DstDoctor_Id *uint `json:"dstDoctor_id"`
|
||||
DstDoctor *ed.Doctor `json:"dstDoctor" gorm:"foreignKey:DstDoctor_Id;references:Id"`
|
||||
RepliedAt *time.Time `json:"repliedAt"`
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
adime "simrs-vx/internal/domain/main-entities/adime"
|
||||
ambulatory "simrs-vx/internal/domain/main-entities/ambulatory"
|
||||
appointment "simrs-vx/internal/domain/main-entities/appointment"
|
||||
chemo "simrs-vx/internal/domain/main-entities/chemo"
|
||||
consultation "simrs-vx/internal/domain/main-entities/consultation"
|
||||
counter "simrs-vx/internal/domain/main-entities/counter"
|
||||
device "simrs-vx/internal/domain/main-entities/device"
|
||||
@@ -145,5 +146,6 @@ func getMainEntities() []any {
|
||||
&mcusubsrc.McuSubSrc{},
|
||||
&mcuordersubitem.McuOrderSubItem{},
|
||||
&consultation.Consultation{},
|
||||
&chemo.Chemo{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ func Reply(input e.ReplyDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if data.Doctor_Id != nil && data.Doctor_Id != doctor_id {
|
||||
if data.DstDoctor_Id != nil && data.DstDoctor_Id != doctor_id {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "data-handled-mismatch",
|
||||
@@ -332,7 +332,7 @@ func Reply(input e.ReplyDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
data.Doctor_Id = doctor_id
|
||||
data.DstDoctor_Id = doctor_id
|
||||
data.Solution = input.Solution
|
||||
data.RepliedAt = pu.GetTimeNow()
|
||||
err = tx.Save(&data).Error
|
||||
|
||||
@@ -18,6 +18,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Consultation) {
|
||||
}
|
||||
|
||||
data.Encounter_Id = inputSrc.Encounter_Id
|
||||
data.Case = inputSrc.Case
|
||||
data.Unit_Id = inputSrc.Unit_Id
|
||||
data.Date = inputSrc.Date
|
||||
data.Problem = inputSrc.Problem
|
||||
data.DstUnit_Id = inputSrc.DstUnit_Id
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user