Merge branch 'dev' into feat/order-things

This commit is contained in:
2025-12-04 13:54:28 +07:00
3 changed files with 21 additions and 5 deletions

No files matched your search

@@ -65,7 +65,20 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.En
tx.Where("\"Responsible_Doctor_Code\" = ?", *input.AuthInfo.Doctor_Code) //
}
tx.Scopes(gh.Preload(input.Includes)).
if input.StartDate != nil && input.EndDate != nil {
tx = tx.Where(
"DATE(\"Encounter\".\"RegisteredAt\") >= DATE(?) AND DATE(\"Encounter\".\"RegisteredAt\") <= DATE(?)",
input.StartDate,
input.EndDate,
)
}
if input.Person_Name != nil {
tx = tx.Joins("JOIN \"Patient\" ON \"Patient\".\"Id\" = \"Encounter\".\"Patient_Id\"").
Joins("JOIN \"Person\" ON \"Person\".\"Id\" = \"Patient\".\"Person_Id\"").Where("\"Person\".\"Name\" ILIKE ?", "%"+*input.Person_Name+"%")
}
tx = tx.Debug().Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).