
            select
                KSG.Mes_tid as "Mes_tid",
                KSG.Mes_sid as "Mes_sid",
                KSG.Mes_kid as "Mes_kid",
                KSG.MesTariff_id as "MesTariff_id",
                KSG.MesOldUslugaComplex_id as "MesOldUslugaComplex_id",
                KSG.Mes_Code as "Mes_Code",
                KSG.MesOld_Num as "MesOld_Num",
                KSG.Mes_Name as "Mes_Name",
                KSG.MesTariff_Value as "MesTariff_Value",
                coalesce(KSG.kpg_code || coalesce('. ' || KSG.kpg_name, ''),'') as "KPG",
                KSG.Error_Message as "Error_Msg"
            from
                r1.EvnPS_KSG_Calc(
                    p_json := '{"evnsection_id":"10101166277823","evnsection_pid":"10101166277819","evnsection_setdt":"2023-06-30","evnsection_disdt":"2023-07-07","person_id":"10101000166352","diag_id":"7298","paytype_id":"250","lpusection_id":"10101000001429","lpusectionprofile_id":"20000619","lpusectionbedprofile_id":"4054","lpuunittype_id":"1","htmedicalcareclass_id":null,"diagpriem_id":null,"rehabscale_id":null,"evnsection_isrehab":null,"evnsection_ispartialpay":null,"cureresult_id":null,"evnsection_sofascalepoints":null,"evnsection_isadultescort":"1","mesdop_ids":[],"drugtherapyscheme_ids":[],"evnsection_absence":null}'
                ) KSG
        
