    with curDateTime as (select localtimestamp as curDateTime)
    SELECT
        count(ds.DocumentsSigning_id) as cnt
    FROM
        dbo.DocumentsSigning ds
    WHERE
        ds.EMDDocumentTypeLocal_id in (30)
        AND coalesce(ds.DocumentsSigning_IsSigned, 1) = 1
        AND coalesce(ds.DocumentsSigning_deleted, 1) = 1
        AND ds.DocumentsSigning_isNotice = 2
        AND ds.DocumentsSigning_MinCount > 0
        AND dateadd('month', 15, ds.DocumentsSigning_setDT) > (select curDateTime from curDateTime)
         AND ds.Lpu_id = 13101156  AND ds.MedPersonal_id = '86252' 
