
            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 := '330101109675153',
                Lpu_id := '13102041',
                Server_id := 13102041,
                PersonEvn_id := '330101036402946',
                EvnVizitDispDop_setDT := '2023-07-30 21:00:00.000',
                EvnVizitDispDop_didDT := '2023-07-30 21:00:00.000',
                OrpDispSpec_id := NULL,
                Diag_id := '10944',
                TumorStage_id := NULL,
                EvnVizitDispDop_DeseaseStage := NULL,
                LpuSection_id := '330101000007121',
                MedPersonal_id := '330101000040559',
                MedStaffFact_id := '330101000028093',
                MedStaffFact_sid := NULL,
                DopDispDiagType_id := NULL,
                DiagValidityType_id := NULL,
                EvnVizitDispDop_isProf := NULL,
                EvnVizitDispDop_isSomatic := NULL,
                EvnVizitDispDop_isInfect := NULL,
                DopDispInfoConsent_id := '330101004581142',
                EvnVizitDispDop_IsFirstTime := (SELECT IsFirstTime FROM cte),
                EvnVizitDispDop_IsVMP := (SELECT IsVMP FROM cte),
                DispSurveilType_id := (SELECT DST_id FROM cte),
                ElectronicService_id := NULL,
                UslugaComplex_id := '205853',
                pmUser_id := '404661568731');
        
