
            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
                r40.EvnPS_KSG_Calc(
                    p_json := '{"evnsection_id":"400101227675689","evnsection_pid":"400101227675668","evnsection_setdt":"2023-07-30","evnsection_disdt":null,"person_id":"572344","diag_id":"7947","paytype_id":"161","lpusection_id":"400101000001042","lpusectionprofile_id":"20001826","lpusectionbedprofile_id":"4809","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
        
