adjust medicinemethod and group size, add encounter entity
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
package encounter
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ep "simrs-vx/internal/domain/main-entities/patient"
|
||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
"time"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Patient_Id *uint `json:"patient_id"`
|
||||
Patient *ep.Patient `json:"patient,omitempty"`
|
||||
RegisteredAt *time.Time `json:"registeredAt"`
|
||||
Class_Code ere.EncounterClassCode `json:"class_code" validate:"maxLength=10"`
|
||||
Unit_Id *uint `json:"unit_id"`
|
||||
VisitDate time.Time `json:"visitDate"`
|
||||
Assignment_Doctor_Id *uint `json:"assignment_doctor_id"`
|
||||
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
|
||||
DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" validate:"maxLength=10"`
|
||||
RefSource_Name *string `json:"refSource_name" validate:"maxLength=100"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Parent_Id *int16 `json:"parent_id"`
|
||||
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
NoPagination int `json:"no_pagination"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Parent_Id *int16 `json:"parent_id"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
PageNumber int `json:"page_number"`
|
||||
PageSize int `json:"page_size"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Patient_Id *uint `json:"patient_id"`
|
||||
Patient *ep.Patient `json:"patient,omitempty"`
|
||||
RegisteredAt *time.Time `json:"registeredAt"`
|
||||
Class_Code ere.EncounterClassCode `json:"class_code"`
|
||||
Unit_Id *uint `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
VisitDate time.Time `json:"visitDate"`
|
||||
Assignment_Doctor_Id *uint `json:"assignment_doctor_id"`
|
||||
Assignment_Doctor *ed.Doctor `json:"assignment_doctor,omitempty"`
|
||||
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
|
||||
Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty"`
|
||||
DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code`
|
||||
RefSource_Name *string `json:"refSource_name"`
|
||||
}
|
||||
|
||||
func (d Encounter) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Patient_Id: d.Patient_Id,
|
||||
Patient: d.Patient,
|
||||
RegisteredAt: d.RegisteredAt,
|
||||
Class_Code: d.Class_Code,
|
||||
Unit_Id: d.Unit_Id,
|
||||
Unit: d.Unit,
|
||||
VisitDate: d.VisitDate,
|
||||
Assignment_Doctor_Id: d.Assignment_Doctor_Id,
|
||||
Assignment_Doctor: d.Assignment_Doctor,
|
||||
Responsible_Doctor_Id: d.Responsible_Doctor_Id,
|
||||
Responsible_Doctor: d.Responsible_Doctor,
|
||||
DischardeMethod_Code: d.DischardeMethod_Code,
|
||||
RefSource_Name: d.RefSource_Name,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
}
|
||||
|
||||
func ToResponseList(data []Encounter) []ResponseDto {
|
||||
resp := make([]ResponseDto, len(data))
|
||||
for i, u := range data {
|
||||
resp[i] = u.ToResponse()
|
||||
}
|
||||
return resp
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package encounter
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ep "simrs-vx/internal/domain/main-entities/patient"
|
||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Encounter struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Patient_Id *uint `json:"patient_id"`
|
||||
Patient *ep.Patient `json:"patient,omitempty" gorm:"foreignKey:Patient_Id;references:Id"`
|
||||
RegisteredAt *time.Time `json:"registeredAt"`
|
||||
Class_Code ere.EncounterClassCode `json:"class_code" gorm:"not null;size:10"`
|
||||
Unit_Id *uint `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
VisitDate time.Time `json:"visitDate"`
|
||||
Assignment_Doctor_Id *uint `json:"assignment_doctor_id"`
|
||||
Assignment_Doctor *ed.Doctor `json:"assignment_doctor,omitempty" gorm:"foreignKey:Assignment_Doctor_Id;references:Id"`
|
||||
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
|
||||
Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty" gorm:"foreignKey:Responsible_Doctor_Id;references:Id"`
|
||||
DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" gorm:"size:10"`
|
||||
RefSource_Name *string `json:"refSource_name" gorm:"size:100"`
|
||||
}
|
||||
@@ -6,6 +6,6 @@ import (
|
||||
|
||||
type MedicineGroup struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:50"`
|
||||
Name string `json:"name" gorm:"size:100"`
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ import (
|
||||
|
||||
type MedicineMethod struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:50"`
|
||||
Name string `json:"name" gorm:"size:100"`
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
doctor "simrs-vx/internal/domain/main-entities/doctor"
|
||||
doctorfee "simrs-vx/internal/domain/main-entities/doctor-fee"
|
||||
employee "simrs-vx/internal/domain/main-entities/employee"
|
||||
encounter "simrs-vx/internal/domain/main-entities/encounter"
|
||||
ethnic "simrs-vx/internal/domain/main-entities/ethnic"
|
||||
infra "simrs-vx/internal/domain/main-entities/infra"
|
||||
installation "simrs-vx/internal/domain/main-entities/installation"
|
||||
@@ -125,6 +126,7 @@ func GetEntities() []any {
|
||||
&language.Language{},
|
||||
&personrelative.PersonRelative{},
|
||||
&patient.Patient{},
|
||||
&encounter.Encounter{},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user