
            select
                RTRIM(COALESCE(Lpu.Lpu_Name, '')) as "Lpu_Name",
                RTRIM(COALESCE(uaddr.Address_Address, '')) as "Lpu_UAddress",
                RTRIM(COALESCE(Org.Org_Phone, '')) as "Lpu_Phone",
                RTRIM(RTRIM(COALESCE(PS.Person_Surname, '')) || ' ' || RTRIM(COALESCE(PS.Person_Firname, '')) || ' ' || RTRIM(COALESCE(PS.Person_Secname, ''))) as "Person_Fio",
                RTRIM(COALESCE(Sex.Sex_Name, '')) as "Sex_Name",
                to_char (PS.Person_Birthday, 'dd.mm.yyyy') as "Person_Birthday",
   				COALESCE(to_char (EvnDtpWound_ObrDate, 'dd.mm.yyyy'), '') as "EvnDtpWound_ObrDate",
   				COALESCE(to_char (EvnDtpWound_HospDate, 'dd.mm.yyyy'), '') as "EvnDtpWound_HospDate",
   				COALESCE(to_char (EvnDtpWound_DtpDate, 'dd.mm.yyyy'), '') as "EvnDtpWound_DtpDate",
   				COALESCE(to_char (EvnDtpWound_setDate, 'dd.mm.yyyy'), '') as "EvnDtpWound_setDate",
   				RTRIM(COALESCE(DiagP.Diag_Code, '')) as "DiagP_Code",
                RTRIM(COALESCE(DiagP.Diag_Name, '')) as "DiagP_Name",
                RTRIM(COALESCE(DiagE.Diag_Code, '')) as "DiagE_Code",
                RTRIM(COALESCE(DiagE.Diag_Name, '')) as "DiagE_Name",
   				COALESCE(to_char (EvnDtpWound_OtherLpuDate, 'dd.mm.yyyy'), '') as "EvnDtpWound_OtherLpuDate",
                RTRIM(COALESCE(OtherLpu.Lpu_Name, '')) as "OtherLpu_Name",
                RTRIM(COALESCE(DiagO.Diag_Code, '')) as "DiagO_Code",
                RTRIM(COALESCE(DiagO.Diag_Name, '')) as "DiagO_Name",
                MP.Dolgnost_Name as "MedPersonal_Dolgnost",
                MP.Person_Fin as "MedPersonal_Fin"
            from v_EvnDtpWound EDW
                inner join v_Lpu Lpu on Lpu.Lpu_id = EDW.Lpu_id
                inner join v_Person_all PS on PS.Server_id = EDW.Server_id
                    and PS.PersonEvn_id = EDW.PersonEvn_id
                left join Address as uaddr on uaddr.Address_id = Lpu.UAddress_id
                left join v_Org Org on Org.Org_id = Lpu.Org_id
                left join Sex on Sex.Sex_id = PS.Sex_id
                left join Diag DiagP on DiagP.Diag_id = EDW.Diag_pid
                left join Diag DiagE on DiagE.Diag_id = EDW.Diag_eid
                left join Diag DiagO on DiagO.Diag_id = EDW.Diag_oid
                left join v_Lpu as OtherLpu on OtherLpu.Lpu_id = EDW.Lpu_oid
                left join v_MedPersonal MP on MP.MedPersonal_id = EDW.MedPersonal_id
            where
                EDW.EvnDtpWound_id = '500801213264270'
                and EDW.Lpu_id = '13100932'
        
