
						SELECT
							ex.Evn_id as "Evn_id",
							--e.EvnClass_SysNick as "EvnClass_SysNick",
							ex.XmlType_id as "XmlType_id",
							xt.XmlTypeKind_id as "XmlTypeKind_id",
							case
								when e.EvnClass_SysNick ='EvnUslugaTelemed'
								then (
									case
										when exists (select	EUT.EvnUslugaTelemed_id
														from
															v_EvnUslugaTelemed EUT
															inner JOIN v_EvnConcilium EC on EC.EvnConcilium_pid = eut.EvnDirection_id
														where EUT.EvnUslugaTelemed_id= e.Evn_id)
										then 'EvnUslugaTelemedConcilium'
										else 'EvnUslugaTelemed'
									end)
								else e.EvnClass_SysNick
							end as "EvnClass_SysNick"
						FROM
							v_EvnXml ex
							inner join v_Evn e on e.Evn_id = ex.Evn_id
							left join v_XmlTemplate xt on xt.XmlTemplate_id = ex.XmlTemplate_id
						WHERE
							e.Evn_id is not null and ex.EvnXml_id  in('500801000986592')
						limit 1
					
