38 lines
838 B
SQL
38 lines
838 B
SQL
SELECT
|
|
source_dataset_key,
|
|
source_dataset_id,
|
|
source_dataset_name,
|
|
categoria_linea,
|
|
categoria_canonica,
|
|
categoria_slug,
|
|
expediente,
|
|
registro_sanitario,
|
|
producto,
|
|
titular,
|
|
estado_registro,
|
|
fecha_expedicion,
|
|
fecha_vencimiento,
|
|
modalidad,
|
|
grupo,
|
|
marca,
|
|
principio_activo,
|
|
forma_farmaceutica,
|
|
presentacion_comercial,
|
|
atc,
|
|
rol_nombre,
|
|
rol_tipo,
|
|
ciudad_titular,
|
|
pais_titular,
|
|
fabricante,
|
|
importador,
|
|
vigencia
|
|
FROM invima_api_catalog
|
|
WHERE source_dataset_key = 'dispositivos'
|
|
AND (
|
|
(COALESCE(estado_registro, '') ILIKE '%vigente%' OR COALESCE(vigencia, '') ILIKE '%vigente%')
|
|
AND COALESCE(estado_registro, '') NOT ILIKE '%no vigente%'
|
|
AND COALESCE(vigencia, '') NOT ILIKE '%no vigente%'
|
|
)
|
|
ORDER BY fecha_vencimiento DESC NULLS LAST, producto ASC NULLS LAST
|
|
LIMIT 25 OFFSET 0;
|