
            select distinct
                case when pUC.PMUser_id is null then 0 else pUC.PMUser_id end as "UserSend_id",
                case when pUC.PMUser_id is null then 'Система' else RTRIM((case when (pUC.PMUser_surName is not null) then RTRIM(pUC.PMUser_surName) || ' ' else '' end) ||
                    (case when (pUC.PMUser_firName is not null) then SUBSTRING(RTRIM(pUC.PMUser_firName),1,1) || '. ' else '' end) ||
                    (case when (pUC.PMUser_secName is not null) then SUBSTRING(RTRIM(pUC.PMUser_secName),1,1) || '. ' else ' ' end) ||
                    (case when (LPU.Lpu_Nick is not null) then '/' || RTRIM(LPU.Lpu_Nick) else '' end) ||
                    (case when (MP.Dolgnost_Name is not null) then '/' || RTRIM(MP.Dolgnost_Name) else '' end)
                ) end as "UserSend_Name"
            from
                msg.v_MessageRecipient MR

                left join msg.v_Message M  on M.Message_id = MR.Message_id

                left join pmUserCache pUC  on pUC.PMUser_id = M.UserSend_ID

                left join v_Lpu_all LPU  on LPU.Lpu_id = pUC.Lpu_id

                left join v_MedPersonal MP  on MP.MedPersonal_id = pUC.MedPersonal_id

                    and pUC.Lpu_id = MP.Lpu_id
            where
                UserRecipient_id = '374517335080'
        
