
            WITH cte AS (
                    select
                    	CASE WHEN NULL is not null
                            and '10944' is not null
                            and not exists (select Diag_id from v_Diag  where Diag_id = '10944' and left(Diag_Code, 1) = 'Z')
                        THEN
                            DispSurveilType_id ELSE null END as DST_id,
                    	CASE WHEN NULL is not null
                            and '10944' is not null
                            and not exists (select Diag_id from v_Diag  where Diag_id = '10944' and left(Diag_Code, 1) = 'Z')
                        THEN
                            EvnVizitDispDop_IsFirstTime ELSE null END  as IsFirstTime,
                    	CASE WHEN NULL is not null
                            and '10944' is not null
                            and not exists (select Diag_id from v_Diag  where Diag_id = '10944' and left(Diag_Code, 1) = 'Z')
                        THEN
                            EvnVizitDispDop_IsVMP ELSE null END  as IsVMP
                    from v_EvnVizitDispDop
                    where EvnVizitDispDop_id = NULL
                    limit 1
            )

            select EvnVizitDispDop_id as "EvnVizitDispDop_id", Error_Code as "Error_Code", Error_Message as "Error_Msg"
            from dbo.p_EvnVizitDispDop_ins(
                EvnVizitDispDop_id := NULL,
                EvnVizitDispDop_pid := '890101022714575',
                Lpu_id := '13101873',
                Server_id := 13101873,
                PersonEvn_id := '890101010609130',
                EvnVizitDispDop_setDT := '2022-03-15 11:25:00.000',
                EvnVizitDispDop_didDT := '2022-03-15 11:25:00.000',
                Diag_id := '10944',
                TumorStage_id := NULL,
                EvnVizitDispDop_DeseaseStage := NULL,
                LpuSection_id := '890101000001239',
                MedPersonal_id := '890101000010729',
                MedStaffFact_id := '890101000019850',
                MedStaffFact_sid := NULL,
                DopDispDiagType_id := NULL,
                DopDispInfoConsent_id := '890101000806695',
                EvnVizitDispDop_IsFirstTime := (SELECT IsFirstTime FROM cte),
                EvnVizitDispDop_IsVMP := (SELECT IsVMP FROM cte),
                DispSurveilType_id := (SELECT DST_id FROM cte),
                ElectronicService_id := NULL,
                UslugaComplex_id := '206892',
                pmUser_id := '385318677811');
        
