feat/prescription: updated entities
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package medicineform
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code *string `json:"code" validate:"maxLength=20"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Sort string `json:"sort"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id *uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id *uint `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
PageNumber int `json:"page_number"`
|
||||
PageSize int `json:"page_size"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func (d MedicineForm) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
}
|
||||
|
||||
func ToResponseList(data []MedicineForm) []ResponseDto {
|
||||
resp := make([]ResponseDto, len(data))
|
||||
for i, u := range data {
|
||||
resp[i] = u.ToResponse()
|
||||
}
|
||||
return resp
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package medicineform
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
)
|
||||
|
||||
type MedicineForm struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:20"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
}
|
||||
@@ -57,6 +57,7 @@ import (
|
||||
medicationitem "simrs-vx/internal/domain/main-entities/medication-item"
|
||||
medicationitemdist "simrs-vx/internal/domain/main-entities/medication-item-dist"
|
||||
medicine "simrs-vx/internal/domain/main-entities/medicine"
|
||||
medicineform "simrs-vx/internal/domain/main-entities/medicine-form"
|
||||
medicinegroup "simrs-vx/internal/domain/main-entities/medicine-group"
|
||||
medicinemethod "simrs-vx/internal/domain/main-entities/medicine-method"
|
||||
medicinemix "simrs-vx/internal/domain/main-entities/medicine-mix"
|
||||
@@ -145,6 +146,7 @@ func getMainEntities() []any {
|
||||
ðnic.Ethnic{},
|
||||
&insurancecompany.InsuranceCompany{},
|
||||
&medicine.Medicine{},
|
||||
&medicineform.MedicineForm{},
|
||||
&medicinemix.MedicineMix{},
|
||||
&medicinemixitem.MedicineMixItem{},
|
||||
&medicalactionsrc.MedicalActionSrc{},
|
||||
|
||||
Reference in New Issue
Block a user