
                
                    with mv as (
                        select
                            null::bigint as EvnVK_IsFail,
                            null::bigint as EvnVK_IsSigned,
                            null::bigint as pmUser_signID,
                            null::timestamp as EvnVK_signDT
                    )
                
                select
                    EvnVK_id as "EvnVK_id",
                    Error_Code as "Error_Code",
                    Error_Message as "Error_Msg"
                from dbo.p_EvnVK_ins(
                    EvnVK_id := NULL,
                    Lpu_id := '2703',
                    Server_id := 5009,
                    EvnVK_setDT := '2023-07-25',
                    EvnVK_isReserve := 1,
                    MedPersonal_id := '110101000000612',
                    EvnVK_didDT := NULL,
                    EvnVK_isControl := 1,
                    MedService_id := '110101000001590',
                    EvnVK_NumCard := NULL,
                    PatientStatusType_id := NULL,
                    EvnVK_Prof := '.',
                    CauseTreatmentType_id := '4',
                    Diag_id := '3163',
                    Diag_sid := NULL,
                    ExpertiseNameType_id := '1',
                    ExpertiseEventType_id := '12',
                    ExpertiseNameSubjectType_id := '1',
                    EvnStickBase_id := NULL,
                    EvnStickWorkRelease_id := NULL,
                    EvnVK_ExpertiseStickNumber := NULL,
                    EvnVK_StickPeriod := 32,
                    EvnVK_StickDuration := NULL,
                    EvnVK_DirectionDate := NULL,
                    EvnVK_ConclusionDate := NULL,
                    EvnVK_ConclusionPeriodDate := NULL,
                    EvnVK_ConclusionDescr := NULL,
                    EvnVK_AddInfo := NULL,
                    EvnVK_isUseStandard := 1,
                    EvnVK_isAberration := 1,
                    EvnVK_isErrors := 1,
                    EvnVK_isResult := 2,
                    EvnVK_UseStandard := NULL,
                    EvnVK_AberrationDescr := NULL,
                    EvnVK_ErrorsDescr := NULL,
                    EvnVK_ResultDescr := '.',
                    EvnVK_ExpertDescr := NULL,
                    EvnVK_DecisionVK := 'нетрудоспособен, текущий л/н закрыть к оплате, продолжает болеть, выдать продолжение л/н с 25.07____по____ 08.08.2023, явка на прием  08.08.2023',
                    PersonEvn_id := '110101021237519',
                    EvnVK_NumProtocol := '163',
                    EvnVK_isAutoFill := 2,
                    EvnPrescrVK_id := '110101366012457',
                    EvnVK_LVN := '910183559214',
                    EvnVk_Note := NULL,
                    EvnVK_WorkReleasePeriod := '25.07- 08.08',
                    EvnVK_MainDisease := '.',
                    EvnVK_isInternal := '2',
                    EvnVK_isAccepted := NULL,
                    EvnVK_AlertDT := NULL,
                    AlertType_id := NULL,
                    CareStageType_id := NULL,
                    SMUslugaType_id := NULL,
                    EvnVK_IsSigned := (select EvnVK_IsSigned from mv),
                    EvnVK_IsFail := (select EvnVK_IsFail from mv),
                    pmUser_signID := (select pmUser_signID from mv),
                    EvnVK_signDT := (select EvnVK_signDT from mv),
                    pmUser_id := '391971343159'
                )
            
