fix filtering

This commit is contained in:
dpurbosakti
2025-09-01 15:15:08 +07:00
parent 7e67b7936e
commit 8af9504a7e
33 changed files with 187 additions and 12 deletions
@@ -11,6 +11,12 @@ type CreateDto struct {
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
}
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
CheckupCategory_Code *string `json:"checkupCategory_code"`
@@ -14,6 +14,12 @@ type CreateDto struct {
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
}
type FilterDto struct {
MedicalActionSrc_Id *uint `json:"medicalActionSrc_id"`
ProcedureSrc_Id *uint `json:"procedureSrc_id"`
Item_Id *uint `json:"item_id"`
@@ -12,6 +12,12 @@ type CreateDto struct {
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
}
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
Item_Id *uint `json:"item_id"`
@@ -13,6 +13,12 @@ type CreateDto struct {
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
}
type FilterDto struct {
MedicineMix_Id *uint `json:"medicineMix_id"`
Medicine_Id *uint `json:"medicine_id"`
Dose *uint8 `json:"dose"`
@@ -22,6 +22,12 @@ type CreateDto struct {
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
}
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
MedicineGroup_Code *string `json:"medicineGroup_code"`
+6 -1
View File
@@ -11,6 +11,12 @@ type CreateDto struct {
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
}
type FilterDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
@@ -18,7 +24,6 @@ type ReadListDto struct {
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Employee_Id *uint `json:"employee_id"`
@@ -11,6 +11,12 @@ type CreateDto struct {
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
}
type FilterDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
@@ -23,6 +23,23 @@ type CreateDto struct {
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
}
type FilterDto struct {
Name string `json:"name"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
Religion_Code *erp.ReligionCode `json:"religion_code"`
Education_Code *erp.EducationCode `json:"education_code"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code"`
Ocupation_Name *string `json:"occupation_name"`
Ethnic_Code *string `json:"ethnic_code"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
@@ -11,6 +11,12 @@ type CreateDto struct {
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
}
type FilterDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
@@ -14,6 +14,12 @@ type CreateDto struct {
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
}
type FilterDto struct {
Doctor_Id *uint `json:"doctor_id"`
Unit_Code *string `json:"unit_code"`
Day_Code *erc.DayCode `json:"day_code"`
@@ -12,6 +12,12 @@ type CreateDto struct {
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
}
type FilterDto struct {
Installation_Id *uint16 `json:"installation_id"`
Code string `json:"code"`
Name string `json:"name"`
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -51,9 +51,15 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Mc
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.McuSrc{}).
Scopes(gh.Filter(input)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -51,9 +51,15 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Me
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.MedicalActionSrcItem{}).
Scopes(gh.Filter(input)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -51,9 +51,15 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Me
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.MedicalActionSrc{}).
Scopes(gh.Filter(input)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -51,9 +51,15 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Me
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.MedicineMixItem{}).
Scopes(gh.Filter(input)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
@@ -90,6 +90,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -51,9 +51,15 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Me
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Medicine{}).
Scopes(gh.Filter(input)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
+7 -1
View File
@@ -51,9 +51,15 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Nu
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Nurse{}).
Scopes(gh.Filter(input)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -51,9 +51,15 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Nu
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Nutritionist{}).
Scopes(gh.Filter(input)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -51,9 +51,15 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Pe
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Person{}).
Scopes(gh.Filter(input)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -51,9 +51,15 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Ph
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Pharmacist{}).
Scopes(gh.Filter(input)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -51,9 +51,15 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Pr
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.PracticeSchedule{}).
Scopes(gh.Filter(input)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
+7 -1
View File
@@ -51,10 +51,16 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Un
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Unit{}).
Preload("Installation").
Scopes(gh.Filter(input)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")