fix
This commit is contained in:
parent
b526c68404
commit
fa6c763b71
3 changed files with 127 additions and 37 deletions
|
|
@ -655,7 +655,7 @@ SELECT
|
||||||
r.first_name,
|
r.first_name,
|
||||||
r.middle_name,
|
r.middle_name,
|
||||||
r.gender,
|
r.gender,
|
||||||
r.snils,
|
regexp_replace(r.snils, '[^0-9]', '', 'g') AS snils,
|
||||||
r.inn,
|
r.inn,
|
||||||
r.birth_date,
|
r.birth_date,
|
||||||
r.age,
|
r.age,
|
||||||
|
|
@ -761,14 +761,11 @@ join adresses adr ON r.recruit_id=adr.recruit_id</sql>
|
||||||
<only_when_have_rows>N</only_when_have_rows>
|
<only_when_have_rows>N</only_when_have_rows>
|
||||||
<partitioning_daily>N</partitioning_daily>
|
<partitioning_daily>N</partitioning_daily>
|
||||||
<partitioning_enabled>N</partitioning_enabled>
|
<partitioning_enabled>N</partitioning_enabled>
|
||||||
<partitioning_field/>
|
|
||||||
<partitioning_monthly>Y</partitioning_monthly>
|
<partitioning_monthly>Y</partitioning_monthly>
|
||||||
<return_field/>
|
|
||||||
<return_keys>N</return_keys>
|
<return_keys>N</return_keys>
|
||||||
<schema>ervu_dashboard</schema>
|
<schema>ervu_dashboard</schema>
|
||||||
<specify_fields>N</specify_fields>
|
<specify_fields>N</specify_fields>
|
||||||
<table>citizen</table>
|
<table>citizen</table>
|
||||||
<tablename_field/>
|
|
||||||
<tablename_in_field>N</tablename_in_field>
|
<tablename_in_field>N</tablename_in_field>
|
||||||
<tablename_in_table>Y</tablename_in_table>
|
<tablename_in_table>Y</tablename_in_table>
|
||||||
<truncate>N</truncate>
|
<truncate>N</truncate>
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,55 @@
|
||||||
<modified_date>2024/08/15 14:02:51.713</modified_date>
|
<modified_date>2024/08/15 14:02:51.713</modified_date>
|
||||||
</info>
|
</info>
|
||||||
<notepads>
|
<notepads>
|
||||||
|
<notepad>
|
||||||
|
<backgroundcolorblue>251</backgroundcolorblue>
|
||||||
|
<backgroundcolorgreen>232</backgroundcolorgreen>
|
||||||
|
<backgroundcolorred>201</backgroundcolorred>
|
||||||
|
<bordercolorblue>90</bordercolorblue>
|
||||||
|
<bordercolorgreen>58</bordercolorgreen>
|
||||||
|
<bordercolorred>14</bordercolorred>
|
||||||
|
<fontbold>N</fontbold>
|
||||||
|
<fontcolorblue>90</fontcolorblue>
|
||||||
|
<fontcolorgreen>58</fontcolorgreen>
|
||||||
|
<fontcolorred>14</fontcolorred>
|
||||||
|
<fontitalic>N</fontitalic>
|
||||||
|
<fontname>Segoe UI</fontname>
|
||||||
|
<fontsize>9</fontsize>
|
||||||
|
<height>328</height>
|
||||||
|
<xloc>976</xloc>
|
||||||
|
<yloc>144</yloc>
|
||||||
|
<note>архив
|
||||||
|
WITH ugol AS (
|
||||||
|
SELECT
|
||||||
|
jsonb_array_elements(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') AS u,
|
||||||
|
ri.recruit_id
|
||||||
|
FROM public.recruits_info ri
|
||||||
|
WHERE jsonb_typeof(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') = 'array'
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
r.id AS recruit_id,
|
||||||
|
u->'sledSud'->>'naimSud' AS kind,
|
||||||
|
TO_DATE(u->'sledSud'->>'dataVozbUD', 'YYYY-MM-DD') AS create_date,
|
||||||
|
TO_DATE(u->'sledSud'->'svedSnyat'->>'dataSnyatSud', 'YYYY-MM-DD') AS close_date,
|
||||||
|
u->'sledSud'->>'naimOrgan' AS authority_name,
|
||||||
|
STRING_AGG(TRIM(BOTH ' "' FROM law.f), ', ') AS law_point,
|
||||||
|
u->'sledSud'->'svedSnyat'->>'osnSnyatSud' AS termination_basis
|
||||||
|
FROM public.recruits r
|
||||||
|
JOIN ugol ON r.id = ugol.recruit_id
|
||||||
|
LEFT JOIN LATERAL jsonb_array_elements_text(u->'sledSud'->'statiUK') AS law(f) ON true
|
||||||
|
GROUP BY r.id, kind, create_date, close_date, authority_name, termination_basis;</note>
|
||||||
|
<width>486</width>
|
||||||
|
</notepad>
|
||||||
</notepads>
|
</notepads>
|
||||||
<order>
|
<order>
|
||||||
<hop>
|
<hop>
|
||||||
<from>Table input</from>
|
<from>Table input (prosecution)</from>
|
||||||
<to>Table output</to>
|
<to>Table output (prosecution)</to>
|
||||||
<enabled>Y</enabled>
|
<enabled>Y</enabled>
|
||||||
</hop>
|
</hop>
|
||||||
</order>
|
</order>
|
||||||
<transform>
|
<transform>
|
||||||
<name>Table input</name>
|
<name>Table input (prosecution)</name>
|
||||||
<type>TableInput</type>
|
<type>TableInput</type>
|
||||||
<description/>
|
<description/>
|
||||||
<distribute>Y</distribute>
|
<distribute>Y</distribute>
|
||||||
|
|
@ -40,34 +79,54 @@
|
||||||
<connection>ervu_person_registry</connection>
|
<connection>ervu_person_registry</connection>
|
||||||
<execute_each_row>N</execute_each_row>
|
<execute_each_row>N</execute_each_row>
|
||||||
<limit>0</limit>
|
<limit>0</limit>
|
||||||
<sql>WITH ugol AS (
|
<sql>WITH
|
||||||
SELECT
|
ugolov_presl AS (
|
||||||
jsonb_array_elements(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') AS u,
|
SELECT
|
||||||
ri.recruit_id
|
jsonb_array_elements(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') AS up,
|
||||||
FROM public.recruits_info ri
|
ri.recruit_id
|
||||||
WHERE jsonb_typeof(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') = 'array'
|
--'prOtsSvedUgolovPresl'
|
||||||
|
FROM public.recruits_info ri
|
||||||
|
WHERE jsonb_typeof(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') = 'array'
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
r.id AS recruit_id,
|
r.id AS recruit_id,
|
||||||
u->'sledSud'->>'naimSud' AS kind,
|
--up->'sledSud'->>'uk', -- уголовный кодекс?
|
||||||
TO_DATE(u->'sledSud'->>'dataVozbUD', 'YYYY-MM-DD') AS create_date,
|
up->'sledSud'->'extend'->>'nomerUDPredv' AS case_number, -- номер уголовного дела (предварительный)
|
||||||
TO_DATE(u->'sledSud'->'svedSnyat'->>'dataSnyatSud', 'YYYY-MM-DD') AS close_date,
|
up->'sledSud'->'extend'->>'svedPerekvalif' AS reclassification, -- сведения о переквалификации деяния
|
||||||
u->'sledSud'->>'naimOrgan' AS authority_name,
|
--up->'sledSud'->'extend'->>'kodVidUgolovPresl', --
|
||||||
STRING_AGG(TRIM(BOTH ' "' FROM law.f), ', ') AS law_point,
|
up->'sledSud'->'extend'->>'naimVidUgolovPresl' AS kind, -- наименование вида уголовного преследования
|
||||||
u->'sledSud'->'svedSnyat'->>'osnSnyatSud' AS termination_basis
|
CASE
|
||||||
|
WHEN up->'sledSud'->'extend'->>'priznakPeredachSud' = '1' THEN true -- передано в суд
|
||||||
|
ELSE false -- нет или нет инфы
|
||||||
|
END AS transfer_to_court, -- признак передачи в суд уголовного дела в отношении гражданина?
|
||||||
|
|
||||||
|
--up->'sledSud'->>'naimSud', -- Наименование суда???
|
||||||
|
up->'sledSud'->>'nomerUD' AS case_number_court, -- номер уголовного дела??? номер уголовного дела (судебный)
|
||||||
|
STRING_AGG(TRIM(BOTH ' "' FROM law.f), ', ') AS law_point, -- статьи уголовного кодекса
|
||||||
|
up->'sledSud'->>'naimOrgan' AS authority_name, -- наименование органа принявшего решение
|
||||||
|
--up->'sledSud'->'svedSnyat'->>'osnSnyatSud', -- основание прекращения уголовного преследования???
|
||||||
|
--up->'sledSud'->'svedSnyat'->>'dataSnyatSud', -- дата прекращения уголовного преследования
|
||||||
|
--up->'sledSud'->'svedSnyat'->>'dataOsuzhd', -- дата осуждения??? =
|
||||||
|
up->'sledSud'->'svedSnyat'->>'dataVozbUD' AS create_date, -- дата возбуждения уголовного дела
|
||||||
|
up->'sledSud'->'svedSnyat'->>'osnPrekrUD' AS termination_basis, -- основания прекращения уголовного дела = основания прекращения уголовного преследования?
|
||||||
|
--up->'sledSud'->'svedSnyat'->>'statusNaim' , -- ????
|
||||||
|
up->'sledSud'->'svedSnyat'->>'dataPrekrUD' AS close_date--, -- дата прекращения уголовного дела
|
||||||
|
--up->>'sledSudTekst', -- ???
|
||||||
|
--up->>'sledSudPriznak' -- ???
|
||||||
|
--'UG_PRESL' AS info_type
|
||||||
FROM public.recruits r
|
FROM public.recruits r
|
||||||
JOIN ugol ON r.id = ugol.recruit_id
|
JOIN ugolov_presl up ON r.id = up.recruit_id
|
||||||
LEFT JOIN LATERAL jsonb_array_elements_text(u->'sledSud'->'statiUK') AS law(f) ON true
|
LEFT JOIN LATERAL jsonb_array_elements_text(up->'sledSud'->'statiUK') AS law(f) ON true
|
||||||
GROUP BY r.id, kind, create_date, close_date, authority_name, termination_basis;</sql>
|
GROUP BY r.id, up</sql>
|
||||||
<variables_active>N</variables_active>
|
<variables_active>N</variables_active>
|
||||||
<attributes/>
|
<attributes/>
|
||||||
<GUI>
|
<GUI>
|
||||||
<xloc>528</xloc>
|
<xloc>432</xloc>
|
||||||
<yloc>304</yloc>
|
<yloc>304</yloc>
|
||||||
</GUI>
|
</GUI>
|
||||||
</transform>
|
</transform>
|
||||||
<transform>
|
<transform>
|
||||||
<name>Table output</name>
|
<name>Table output (prosecution)</name>
|
||||||
<type>TableOutput</type>
|
<type>TableOutput</type>
|
||||||
<description/>
|
<description/>
|
||||||
<distribute>Y</distribute>
|
<distribute>Y</distribute>
|
||||||
|
|
@ -85,14 +144,11 @@ GROUP BY r.id, kind, create_date, close_date, authority_name, termination_basis;
|
||||||
<only_when_have_rows>N</only_when_have_rows>
|
<only_when_have_rows>N</only_when_have_rows>
|
||||||
<partitioning_daily>N</partitioning_daily>
|
<partitioning_daily>N</partitioning_daily>
|
||||||
<partitioning_enabled>N</partitioning_enabled>
|
<partitioning_enabled>N</partitioning_enabled>
|
||||||
<partitioning_field/>
|
|
||||||
<partitioning_monthly>Y</partitioning_monthly>
|
<partitioning_monthly>Y</partitioning_monthly>
|
||||||
<return_field/>
|
|
||||||
<return_keys>N</return_keys>
|
<return_keys>N</return_keys>
|
||||||
<schema>ervu_dashboard</schema>
|
<schema>ervu_dashboard</schema>
|
||||||
<specify_fields>N</specify_fields>
|
<specify_fields>N</specify_fields>
|
||||||
<table>prosecution</table>
|
<table>prosecution</table>
|
||||||
<tablename_field/>
|
|
||||||
<tablename_in_field>N</tablename_in_field>
|
<tablename_in_field>N</tablename_in_field>
|
||||||
<tablename_in_table>Y</tablename_in_table>
|
<tablename_in_table>Y</tablename_in_table>
|
||||||
<truncate>N</truncate>
|
<truncate>N</truncate>
|
||||||
|
|
|
||||||
|
|
@ -38,16 +38,56 @@
|
||||||
<note>сведения об уголовном преследовании и вынесенном приговоре punishment</note>
|
<note>сведения об уголовном преследовании и вынесенном приговоре punishment</note>
|
||||||
<width>442</width>
|
<width>442</width>
|
||||||
</notepad>
|
</notepad>
|
||||||
|
<notepad>
|
||||||
|
<backgroundcolorblue>251</backgroundcolorblue>
|
||||||
|
<backgroundcolorgreen>232</backgroundcolorgreen>
|
||||||
|
<backgroundcolorred>201</backgroundcolorred>
|
||||||
|
<bordercolorblue>90</bordercolorblue>
|
||||||
|
<bordercolorgreen>58</bordercolorgreen>
|
||||||
|
<bordercolorred>14</bordercolorred>
|
||||||
|
<fontbold>N</fontbold>
|
||||||
|
<fontcolorblue>90</fontcolorblue>
|
||||||
|
<fontcolorgreen>58</fontcolorgreen>
|
||||||
|
<fontcolorred>14</fontcolorred>
|
||||||
|
<fontitalic>N</fontitalic>
|
||||||
|
<fontname>Segoe UI</fontname>
|
||||||
|
<fontsize>9</fontsize>
|
||||||
|
<height>346</height>
|
||||||
|
<xloc>1152</xloc>
|
||||||
|
<yloc>0</yloc>
|
||||||
|
<note>архив
|
||||||
|
with ugol as
|
||||||
|
(select jsonb_array_elements(ri.info->'svedFL'->'svedSudim'->'sudim'->'osuzhdenie') u,
|
||||||
|
ri.recruit_id
|
||||||
|
from public.recruits_info ri
|
||||||
|
where jsonb_typeof(ri.info->'svedFL'->'svedSudim'->'sudim'->'osuzhdenie') = 'array')
|
||||||
|
select
|
||||||
|
r.id recruit_id,
|
||||||
|
u->>'naimSuda' authority_name,
|
||||||
|
u->>'srokNakaz' sentence,
|
||||||
|
u->>'adresNakaz' sentence_place,
|
||||||
|
u->>'kodVidNakaz' punishment_code,
|
||||||
|
u->>'izmSrokNakaz' sentence_changed,
|
||||||
|
u->>'naimVidNakaz' punishment_type,
|
||||||
|
to_date(u->>'dataNachSrok', 'YYYY-MM-DD') start_date,
|
||||||
|
to_date(u->>'dataOsvobozhd', 'YYYY-MM-DD') release_date,
|
||||||
|
to_date(u->>'dataOsuzhd', 'YYYY-MM-DD') sentense_date,
|
||||||
|
u->>'ugolovZakon' law_point,
|
||||||
|
u->>'osnovOsvobozhd' release_reason
|
||||||
|
from public.recruits r
|
||||||
|
join ugol on r.id = ugol.recruit_id;</note>
|
||||||
|
<width>475</width>
|
||||||
|
</notepad>
|
||||||
</notepads>
|
</notepads>
|
||||||
<order>
|
<order>
|
||||||
<hop>
|
<hop>
|
||||||
<from>Table input</from>
|
<from>Table input(punishment)</from>
|
||||||
<to>Table output</to>
|
<to>Table output(punishment)</to>
|
||||||
<enabled>Y</enabled>
|
<enabled>Y</enabled>
|
||||||
</hop>
|
</hop>
|
||||||
</order>
|
</order>
|
||||||
<transform>
|
<transform>
|
||||||
<name>Table input</name>
|
<name>Table input(punishment)</name>
|
||||||
<type>TableInput</type>
|
<type>TableInput</type>
|
||||||
<description/>
|
<description/>
|
||||||
<distribute>Y</distribute>
|
<distribute>Y</distribute>
|
||||||
|
|
@ -88,7 +128,7 @@ join ugol on r.id = ugol.recruit_id;</sql>
|
||||||
</GUI>
|
</GUI>
|
||||||
</transform>
|
</transform>
|
||||||
<transform>
|
<transform>
|
||||||
<name>Table output</name>
|
<name>Table output(punishment)</name>
|
||||||
<type>TableOutput</type>
|
<type>TableOutput</type>
|
||||||
<description/>
|
<description/>
|
||||||
<distribute>Y</distribute>
|
<distribute>Y</distribute>
|
||||||
|
|
@ -106,21 +146,18 @@ join ugol on r.id = ugol.recruit_id;</sql>
|
||||||
<only_when_have_rows>N</only_when_have_rows>
|
<only_when_have_rows>N</only_when_have_rows>
|
||||||
<partitioning_daily>N</partitioning_daily>
|
<partitioning_daily>N</partitioning_daily>
|
||||||
<partitioning_enabled>N</partitioning_enabled>
|
<partitioning_enabled>N</partitioning_enabled>
|
||||||
<partitioning_field/>
|
|
||||||
<partitioning_monthly>Y</partitioning_monthly>
|
<partitioning_monthly>Y</partitioning_monthly>
|
||||||
<return_field/>
|
|
||||||
<return_keys>N</return_keys>
|
<return_keys>N</return_keys>
|
||||||
<schema>ervu_dashboard</schema>
|
<schema>ervu_dashboard</schema>
|
||||||
<specify_fields>N</specify_fields>
|
<specify_fields>N</specify_fields>
|
||||||
<table>punishment</table>
|
<table>punishment</table>
|
||||||
<tablename_field/>
|
|
||||||
<tablename_in_field>N</tablename_in_field>
|
<tablename_in_field>N</tablename_in_field>
|
||||||
<tablename_in_table>Y</tablename_in_table>
|
<tablename_in_table>Y</tablename_in_table>
|
||||||
<truncate>N</truncate>
|
<truncate>N</truncate>
|
||||||
<use_batch>Y</use_batch>
|
<use_batch>Y</use_batch>
|
||||||
<attributes/>
|
<attributes/>
|
||||||
<GUI>
|
<GUI>
|
||||||
<xloc>736</xloc>
|
<xloc>944</xloc>
|
||||||
<yloc>304</yloc>
|
<yloc>304</yloc>
|
||||||
</GUI>
|
</GUI>
|
||||||
</transform>
|
</transform>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue