Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MONITORA REG] MVA - Changes the records filter based on health units #214

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,12 @@ with

left join
estabelecimentos as estab
on ofer.ano_competencia = estab.ano_competencia
and ofer.mes_competencia = estab.mes_competencia
and ofer.id_cnes = estab.id_cnes
-- ma prática temporária (convertendo o tipo durante o join)
on safe_cast(ofer.ano_competencia as int)
= safe_cast(estab.ano_competencia as int)
and safe_cast(ofer.mes_competencia as int)
= safe_cast(estab.mes_competencia as int)
and safe_cast(ofer.id_cnes as int) = safe_cast(estab.id_cnes as int)
),

iqr as (
Expand Down Expand Up @@ -229,7 +232,9 @@ with
on mva.ano_competencia = iqr.ano_competencia
and mva.mes_competencia = iqr.mes_competencia
and mva.id_procedimento = iqr.id_procedimento
where mva.estabelecimento is not null -- removendo registros do CNES de estabelecimentos sem vinculo com o SUS
where
safe_cast(mva.id_cnes as int)
in (select safe_cast(id_cnes as int) from estabelecimentos) -- removendo registros do CNES de estabelecimentos sem vinculo com o SUS

)

Expand Down
Loading