|
|
dep:
|
|
|
- v_listes_1
|
|
|
src: |
|
|
|
(
|
|
|
SELECT v_listes_1.liste_id_combo AS oid,
|
|
|
v_listes_1.texte,
|
|
|
v_listes_1.lvl AS level,
|
|
|
('0'::text || v_listes_1.sort) || chr(1) AS tri1,
|
|
|
CASE
|
|
|
WHEN v_listes_1.is_cti = '1'::text OR v_listes_1.code ~~ 'CTI_%'::text THEN '1'::character(1)
|
|
|
ELSE '0'::character(1)
|
|
|
END AS is_cti
|
|
|
FROM pmsi.v_listes_1
|
|
|
WHERE v_listes_1.table_code = 'MEDECIN'::text AND v_listes_1.lvl <> '0'::text
|
|
|
UNION ALL
|
|
|
SELECT ('LC'::text || lpad(t_classes.sequence::text, 2, '0'::text)) || t_classes.oid::text AS oid,
|
|
|
t_classes.texte,
|
|
|
'1'::text AS level,
|
|
|
'5'::text || btrim(rpad(lpad(t_classes.sequence::text, 2, '0'::text), 10, ' '::text)) AS tri1,
|
|
|
CASE
|
|
|
WHEN t_classes.is_cti = '1'::bpchar OR t_classes.code ~~ 'CTI_%'::text THEN '1'::character(1)
|
|
|
ELSE '0'::character(1)
|
|
|
END AS is_cti
|
|
|
FROM pmsi.t_classes,
|
|
|
pmsi.t_listes_tables
|
|
|
WHERE t_classes.table_id = t_listes_tables.oid AND t_listes_tables.code = 'MEDECIN'::text
|
|
|
UNION ALL
|
|
|
SELECT ('LS'::text || lpad(t_classes.sequence::text, 2, '0'::text)) || t_classes_sections.oid::text AS oid,
|
|
|
t_classes_sections.texte,
|
|
|
'2'::text AS level,
|
|
|
'5'::text || btrim(rpad(lpad(t_classes.sequence::text, 2, '0'::text), 10, ' '::text) || t_classes_sections.code) AS tri1,
|
|
|
CASE
|
|
|
WHEN t_classes.is_cti = '1'::bpchar OR t_classes.code ~~ 'CTI_%'::text THEN '1'::character(1)
|
|
|
ELSE '0'::character(1)
|
|
|
END AS is_cti
|
|
|
FROM pmsi.t_classes,
|
|
|
pmsi.t_classes_sections,
|
|
|
pmsi.t_listes_tables
|
|
|
WHERE t_classes.table_id = t_listes_tables.oid AND t_classes_sections.classe_id = t_classes.oid AND t_listes_tables.code = 'MEDECIN'::text
|
|
|
UNION ALL
|
|
|
SELECT ('LS'::text || lpad(t_classes.sequence::text, 2, '0'::text)) || '0'::text AS oid,
|
|
|
'Section non attribuée'::character varying AS texte,
|
|
|
'2'::text AS level,
|
|
|
'5'::text || btrim(rpad(lpad(t_classes.sequence::text, 2, '0'::text), 10, ' '::text) || chr(255)) AS tri1,
|
|
|
CASE
|
|
|
WHEN t_classes.is_cti = '1'::bpchar OR t_classes.code ~~ 'CTI_%'::text THEN '1'::character(1)
|
|
|
ELSE '0'::character(1)
|
|
|
END AS is_cti
|
|
|
FROM pmsi.t_classes,
|
|
|
pmsi.t_listes_tables
|
|
|
WHERE t_classes.table_id = t_listes_tables.oid AND t_listes_tables.code = 'MEDECIN'::text
|
|
|
) UNION
|
|
|
SELECT '-8'::text AS oid,
|
|
|
'Spécialités internes'::character varying AS texte,
|
|
|
'1'::text AS level,
|
|
|
'7'::text AS tri1,
|
|
|
'0'::character(1) AS is_cti
|
|
|
UNION
|
|
|
( SELECT DISTINCT 'D2'::text || t_medecins_c.specialite_interne_medecin_reference_id::text AS oid,
|
|
|
(t_medecins_c.specialite_interne_medecin_reference_code::text || ' '::text) || t_medecins_c.specialite_interne_medecin_reference_texte::text AS texte,
|
|
|
'2'::text AS level,
|
|
|
'7'::text || t_medecins_c.specialite_interne_medecin_reference_code::text AS tri1,
|
|
|
'0'::character(1) AS is_cti
|
|
|
FROM pmsi.t_medecins_c
|
|
|
WHERE t_medecins_c.oid > 0 AND (t_medecins_c.oid IN ( SELECT p_oids.oid
|
|
|
FROM pmsi.p_oids
|
|
|
WHERE p_oids.code_table::text = 'anesthesistes_intervention'::text))
|
|
|
ORDER BY ('D2'::text || t_medecins_c.specialite_interne_medecin_reference_id::text), ((t_medecins_c.specialite_interne_medecin_reference_code::text || ' '::text) || t_medecins_c.specialite_interne_medecin_reference_texte::text), '2'::text, ('7'::text || t_medecins_c.specialite_interne_medecin_reference_code::text))
|
|
|
UNION
|
|
|
SELECT '-8'::text AS oid,
|
|
|
'Spécialités officielles'::character varying AS texte,
|
|
|
'1'::text AS level,
|
|
|
'8'::text AS tri1,
|
|
|
'0'::character(1) AS is_cti
|
|
|
WHERE 'disabled'::text = '1'::text
|
|
|
UNION
|
|
|
( SELECT DISTINCT 'SO'::text || t_medecins_c.specialite_id::text AS oid,
|
|
|
(t_medecins_c.specialite_medecin_code::text || ' '::text) || t_medecins_c.specialite_medecin_texte::text AS texte,
|
|
|
'2'::text AS level,
|
|
|
'8'::text || t_medecins_c.specialite_medecin_code::text AS tri1,
|
|
|
'0'::character(1) AS is_cti
|
|
|
FROM pmsi.t_medecins_c
|
|
|
WHERE t_medecins_c.oid > 0 AND 'disabled'::text = '1'::text AND (t_medecins_c.oid IN ( SELECT p_oids.oid
|
|
|
FROM pmsi.p_oids
|
|
|
WHERE p_oids.code_table::text = 'anesthesistes_intervention'::text))
|
|
|
ORDER BY ('SO'::text || t_medecins_c.specialite_id::text), ((t_medecins_c.specialite_medecin_code::text || ' '::text) || t_medecins_c.specialite_medecin_texte::text), '2'::text, ('8'::text || t_medecins_c.specialite_medecin_code::text))
|
|
|
UNION
|
|
|
( SELECT DISTINCT 'DT'::text || t_medecins_c.medecin_reference_id::text AS oid,
|
|
|
(((t_medecins_c.medecin_reference_nom_prenom || ' '::text) || ' ('::text) || t_medecins_c.medecin_reference_code) || ')'::text AS texte,
|
|
|
'1'::text AS level,
|
|
|
'9'::text || t_medecins_c.medecin_reference_nom_prenom AS tri1,
|
|
|
'0'::character(1) AS is_cti
|
|
|
FROM pmsi.t_medecins_c
|
|
|
WHERE t_medecins_c.oid > 0 AND (t_medecins_c.oid IN ( SELECT p_oids.oid
|
|
|
FROM pmsi.p_oids
|
|
|
WHERE p_oids.code_table::text = 'anesthesistes_intervention'::text))
|
|
|
ORDER BY ('DT'::text || t_medecins_c.medecin_reference_id::text), ((((t_medecins_c.medecin_reference_nom_prenom || ' '::text) || ' ('::text) || t_medecins_c.medecin_reference_code) || ')'::text), '1'::text, ('9'::text || t_medecins_c.medecin_reference_nom_prenom))
|
|
|
ORDER BY 4;
|