This commit is contained in:
2026-04-17 10:46:06 +07:00
parent cca467ec0f
commit a9878c691f
2 changed files with 18 additions and 8 deletions

View File

@ -1,7 +0,0 @@
{
"printWidth": 5000,
"semi": true,
"singleQuote": false,
"tabWidth": 4,
"useTabs": true
}

View File

@ -40,8 +40,25 @@ export class ReferenceRangeController {
let param: Paging = await schema.validateAsync(req.query);
let filter = param.filter && param.filter !== "" ? JSON.parse(param.filter) : {};
const filterAny = filter.any && filter.any !== "" ? String(filter.any) : "";
let filterObj = { ...filter } as any;
delete filterObj.any;
var query = await ReferenceRangeModel.list(filter);
var query = await ReferenceRangeModel.list(filterObj);
if (filterAny !== "") {
const anyVal = filterAny.includes("%") ? filterAny : `%${filterAny}%`;
query.andWhere(
`(
ReferenceRange.status::text ILIKE :any
OR ReferenceRange.gender::text ILIKE :any
OR ReferenceRange.age_range_min::text ILIKE :any
OR ReferenceRange.age_range_max::text ILIKE :any
OR ReferenceRange.value_min::text ILIKE :any
OR ReferenceRange.value_max::text ILIKE :any
)`,
{ any: anyVal },
);
}
const offset = (param.page - 1) * param.limit;
let limit = param.limit;