delete from RDS.T_FRLLO_CONDITION_DICTIONARY;

INSERT INTO RDS.T_FRLLO_CONDITION_DICTIONARY
           (FrlloConditionDictionaryID
           ,Condition
           ,Actual
           ,FrlloType
           ,Users
           ,Name
           ,FirstExport
           ,AdditionalCondition)
	  select gen_random_uuid(), '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion type="=">
        <lx:Case>
            <When>
                <lx:Criteria type="And">
                    <lx:Criterion type="&gt;=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="LastEditDate" />
                        </lx:Path>
                        <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
                    </lx:Criterion>
                    <lx:CriterionChildExists>
                        <condition>
                            <lx:Criterion not="1" type="=">
                                <lx:Path OwnerQueryLevel="0">
                                    <lx:StepString name="Benefits" />
                                    <lx:StepString name="EhrRusSdo8u3n5ro" />
                                </lx:Path>
                                <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
                            </lx:Criterion>
                        </condition>
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="RrPatientBenefits" />
                        </lx:Path>
                    </lx:CriterionChildExists>
                </lx:Criteria>
            </When>
            <Then>
                <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
            </Then>
            <When>
                <lx:CriterionChildExists>
                    <condition>
                        <lx:Criteria type="And">
                            <lx:Criterion not="1" type="=">
                                <lx:Path OwnerQueryLevel="0">
                                    <lx:StepString name="Benefits" />
                                    <lx:StepString name="EhrRusSdo8u3n5ro" />
                                </lx:Path>
                                <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
                            </lx:Criterion>
                            <lx:Criterion type="&gt;=">
                                <lx:Path OwnerQueryLevel="0">
                                    <lx:StepString name="LastEditDate" />
                                </lx:Path>
                                <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
                            </lx:Criterion>
                        </lx:Criteria>
                    </condition>
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="RrPatientBenefits" />
                    </lx:Path>
                </lx:CriterionChildExists>
            </When>
            <Then>
                <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
            </Then>
            <When>
                <lx:CriterionExists entity="RDS.EXPORT_FRLLO_DATA" top="-1" offset="0">
                    <condition>
                        <lx:Criteria type="And">
                            <lx:Criteria type="Or">
                                <lx:Criterion type="=">
                                    <lx:Path OwnerQueryLevel="0">
                                        <lx:StepString name="FrlloStatus" />
                                    </lx:Path>
                                    <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="400" />
                                </lx:Criterion>
                                <lx:Criterion type="=">
                                    <lx:Path OwnerQueryLevel="0">
                                        <lx:StepString name="FrlloStatus" />
                                    </lx:Path>
                                    <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="1" />
                                </lx:Criterion>
                            </lx:Criteria>
                            <lx:Criterion type="=">
                                <lx:Path OwnerQueryLevel="0">
                                    <lx:StepString name="ObjId" />
                                </lx:Path>
                                <lx:Path OwnerQueryLevel="1">
                                    <lx:StepString name="Id" />
                                </lx:Path>
                            </lx:Criterion>
                            <lx:Criterion type="=">
                                <lx:Path OwnerQueryLevel="0">
                                    <lx:StepString name="ExportFrllo" />
                                    <lx:StepString name="ExportFrlloID" />
                                </lx:Path>
                                <lx:UserQueryOperand type="Const" expectedValueSpecification="Guid" name="IdExport" />
                            </lx:Criterion>
                        </lx:Criteria>
                    </condition>
                </lx:CriterionExists>
            </When>
            <Then>
                <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
            </Then>
            <Else>
                <lx:ConstOperand type="Boolean">False</lx:ConstOperand>
            </Else>
        </lx:Case>
        <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
    </lx:Criterion>
</lx:Criteria>', true, 10, (select UserID from VCLib.T_USERS limit 1), 'Основной', false, '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Benefits" />
            <lx:StepString name="EhrRusSdo8u3n5ro" />
        </lx:Path>
        <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
    </lx:Criterion>
    <lx:Criteria type="Or">
        <lx:Criterion type="=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="EndDate" />
            </lx:Path>
            <lx:Null />
        </lx:Criterion>
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="EndDate" />
            </lx:Path>
            <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
        </lx:Criterion>
    </lx:Criteria>
    <lx:Criteria type="Or">
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="LastEditDate" />
            </lx:Path>
            <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
        </lx:Criterion>
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="RrPatient" />
                <lx:StepString name="LastEditDate" />
            </lx:Path>
            <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
        </lx:Criterion>
        <lx:CriterionExists entity="RDS.EXPORT_FRLLO_DATA" top="-1" offset="0">
            <condition>
                <lx:Criteria type="And">
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="ExportFrllo" />
                            <lx:StepString name="ExportFrlloID" />
                        </lx:Path>
                        <lx:UserQueryOperand type="Const" expectedValueSpecification="Guid" name="IdExport" />
                    </lx:Criterion>
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="ObjId" />
                        </lx:Path>
                        <lx:Path OwnerQueryLevel="1">
                            <lx:StepString name="RrPatient" />
                        </lx:Path>
                    </lx:Criterion>
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="Type" />
                        </lx:Path>
                        <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="Type" type="Int32" PrimaryKey="0" />
                    </lx:Criterion>
                    <lx:Criteria type="Or">
                        <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="FrlloStatus" />
                            </lx:Path>
                            <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="400" />
                        </lx:Criterion>
                        <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="FrlloStatus" />
                            </lx:Path>
                            <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="1" />
                        </lx:Criterion>
                    </lx:Criteria>
                </lx:Criteria>
            </condition>
        </lx:CriterionExists>
    </lx:Criteria>
</lx:Criteria>'
union select gen_random_uuid(), '<lx:CriterionChildExists xmlns:lx="lexem">
    <condition>
        <lx:Criteria type="And">
            <lx:Criterion not="1" type="=">
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="Benefits" />
                    <lx:StepString name="EhrRusSdo8u3n5ro" />
                </lx:Path>
                <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
            </lx:Criterion>
            <lx:Criterion type="&lt;=">
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="BeginDate" />
                </lx:Path>
                <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="ActualDate" />
            </lx:Criterion>
            <lx:Criteria type="Or">
                <lx:Criterion type="=">
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="EndDate" />
                    </lx:Path>
                    <lx:Null />
                </lx:Criterion>
                <lx:Criterion type="&gt;=">
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="EndDate" />
                    </lx:Path>
                    <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
                </lx:Criterion>
            </lx:Criteria>
        </lx:Criteria>
    </condition>
    <lx:Path OwnerQueryLevel="0">
        <lx:StepString name="RrPatientBenefits" />
    </lx:Path>
</lx:CriterionChildExists>', true, 10, (select UserID from VCLib.T_USERS limit 1), 'Первичная выгрузка', true, '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Benefits" />
            <lx:StepString name="EhrRusSdo8u3n5ro" />
        </lx:Path>
        <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
    </lx:Criterion>
    <lx:Criteria type="Or">
        <lx:Criterion type="=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="EndDate" />
            </lx:Path>
            <lx:Null />
        </lx:Criterion>
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="EndDate" />
            </lx:Path>
            <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
        </lx:Criterion>
    </lx:Criteria>
    <lx:Criterion type="&lt;=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="BeginDate" />
        </lx:Path>
        <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="ActualDate" />
    </lx:Criterion>
</lx:Criteria>'
union select gen_random_uuid(), '<lx:Criterion type="=" xmlns:lx="lexem">
    <lx:Case>
        <When>
            <lx:Criteria type="And">
                <lx:Criterion type="&gt;=">
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="LastEditDate" />
                    </lx:Path>
                    <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
                </lx:Criterion>
                <lx:CriterionChildExists>
                    <condition>
                        <lx:Criterion not="1" type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="Benefits" />
                                <lx:StepString name="EhrRusSdo8u3n5ro" />
                            </lx:Path>
                            <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
                        </lx:Criterion>
                    </condition>
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="BskRegisterDatas" />
                    </lx:Path>
                </lx:CriterionChildExists>
            </lx:Criteria>
        </When>
        <Then>
            <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
        </Then>
        <When>
            <lx:CriterionChildExists>
                <condition>
                    <lx:Criteria type="And">
                        <lx:Criterion not="1" type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="Benefits" />
                                <lx:StepString name="EhrRusSdo8u3n5ro" />
                            </lx:Path>
                            <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
                        </lx:Criterion>
                        <lx:Criterion type="&gt;=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="LastEditDate" />
                            </lx:Path>
                            <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
                        </lx:Criterion>
                    </lx:Criteria>
                </condition>
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="BskRegisterDatas" />
                </lx:Path>
            </lx:CriterionChildExists>
        </When>
        <Then>
            <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
        </Then>
        <When>
            <lx:CriterionExists entity="RDS.EXPORT_FRLLO_DATA" top="-1" offset="0">
                <condition>
                    <lx:Criteria type="And">
                        <lx:Criteria type="Or">
                            <lx:Criterion type="=">
                                <lx:Path OwnerQueryLevel="0">
                                    <lx:StepString name="FrlloStatus" />
                                </lx:Path>
                                <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="400" />
                            </lx:Criterion>
                            <lx:Criterion type="=">
                                <lx:Path OwnerQueryLevel="0">
                                    <lx:StepString name="FrlloStatus" />
                                </lx:Path>
                                <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="1" />
                            </lx:Criterion>
                        </lx:Criteria>
                        <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="ObjId" />
                            </lx:Path>
                            <lx:Path OwnerQueryLevel="1">
                                <lx:StepString name="BskRegisterID" />
                            </lx:Path>
                        </lx:Criterion>
                        <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="ExportFrllo" />
                                <lx:StepString name="ExportFrlloID" />
                            </lx:Path>
                            <lx:UserQueryOperand type="Const" expectedValueSpecification="Guid" name="IdExport" />
                        </lx:Criterion>
                    </lx:Criteria>
                </condition>
            </lx:CriterionExists>
        </When>
        <Then>
            <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
        </Then>
        <Else>
            <lx:ConstOperand type="Boolean">False</lx:ConstOperand>
        </Else>
    </lx:Case>
    <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
</lx:Criterion>', true, 11, (select UserID from VCLib.T_USERS limit 1), 'Основной', false, '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Benefits" />
            <lx:StepString name="EhrRusSdo8u3n5ro" />
        </lx:Path>
        <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
    </lx:Criterion>
    <lx:Criteria type="Or">
        <lx:Criterion type="=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="EndDate" />
            </lx:Path>
            <lx:Null />
        </lx:Criterion>
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="EndDate" />
            </lx:Path>
            <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
        </lx:Criterion>
    </lx:Criteria>
    <lx:Criteria type="Or">
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="LastEditDate" />
            </lx:Path>
            <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
        </lx:Criterion>
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="BskRegister" />
                <lx:StepString name="LastEditDate" />
            </lx:Path>
            <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
        </lx:Criterion>
        <lx:CriterionExists entity="RDS.EXPORT_FRLLO_DATA" top="-1" offset="0">
            <condition>
                <lx:Criteria type="And">
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="ExportFrllo" />
                            <lx:StepString name="ExportFrlloID" />
                        </lx:Path>
                        <lx:UserQueryOperand type="Const" expectedValueSpecification="Guid" name="IdExport" />
                    </lx:Criterion>
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="ObjId" />
                        </lx:Path>
                        <lx:Path OwnerQueryLevel="1">
                            <lx:StepString name="BskRegister" />
                        </lx:Path>
                    </lx:Criterion>
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="Type" />
                        </lx:Path>
                        <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="Type" type="Int32" PrimaryKey="0" />
                    </lx:Criterion>
                    <lx:Criteria type="Or">
                        <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="FrlloStatus" />
                            </lx:Path>
                            <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="400" />
                        </lx:Criterion>
                        <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="FrlloStatus" />
                            </lx:Path>
                            <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="1" />
                        </lx:Criterion>
                    </lx:Criteria>
                </lx:Criteria>
            </condition>
        </lx:CriterionExists>
    </lx:Criteria>
</lx:Criteria>'
union select gen_random_uuid(), '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:CriterionChildExists>
        <condition>
            <lx:Criteria type="And">
                <lx:Criterion not="1" type="=">
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="Benefits" />
                        <lx:StepString name="EhrRusSdo8u3n5ro" />
                    </lx:Path>
                    <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
                </lx:Criterion>
                <lx:Criteria type="And">
                    <lx:Criterion type="&lt;=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="BeginDate" />
                        </lx:Path>
                        <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="ActualDate" />
                    </lx:Criterion>
                    <lx:Criteria type="Or">
                        <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="EndDate" />
                            </lx:Path>
                            <lx:Null />
                        </lx:Criterion>
                        <lx:Criterion type="&gt;=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="EndDate" />
                            </lx:Path>
                            <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
                        </lx:Criterion>
                    </lx:Criteria>
                </lx:Criteria>
            </lx:Criteria>
        </condition>
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="BskRegisterDatas" />
        </lx:Path>
    </lx:CriterionChildExists>
</lx:Criteria>', true, 11, (select UserID from VCLib.T_USERS limit 1), 'Первичная выгрузка', true, '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Benefits" />
            <lx:StepString name="EhrRusSdo8u3n5ro" />
        </lx:Path>
        <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
    </lx:Criterion>
    <lx:Criteria type="Or">
        <lx:Criterion type="=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="EndDate" />
            </lx:Path>
            <lx:Null />
        </lx:Criterion>
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="EndDate" />
            </lx:Path>
            <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
        </lx:Criterion>
    </lx:Criteria>
    <lx:Criterion type="&lt;=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="BeginDate" />
        </lx:Path>
        <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="ActualDate" />
    </lx:Criterion>
</lx:Criteria>'
union select gen_random_uuid(), '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Benefits" />
            <lx:StepString name="EhrRusSdo8u3n5ro" />
        </lx:Path>
        <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
    </lx:Criterion>
    <lx:Criteria type="Or">
        <lx:Criterion type="=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="DateOfDeclusion" />
            </lx:Path>
            <lx:Null />
        </lx:Criterion>
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="DateOfDeclusion" />
            </lx:Path>
            <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
        </lx:Criterion>
    </lx:Criteria>
    <lx:Criteria type="Or">
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="DateOfChange" />
            </lx:Path>
            <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
        </lx:Criterion>
        <lx:CriterionExists entity="RDS.EXPORT_FRLLO_DATA" top="-1" offset="0">
            <condition>
                <lx:Criteria type="And">
                    <lx:Criteria type="Or">
                        <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="FrlloStatus" />
                            </lx:Path>
                            <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="400" />
                        </lx:Criterion>
                        <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="FrlloStatus" />
                            </lx:Path>
                            <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="1" />
                        </lx:Criterion>
                    </lx:Criteria>
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="ObjId" />
                        </lx:Path>
                        <lx:Path OwnerQueryLevel="1">
                            <lx:StepString name="SpecialBenefitsRegistrID" />
                        </lx:Path>
                    </lx:Criterion>
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="ExportFrllo" />
                            <lx:StepString name="ExportFrlloID" />
                        </lx:Path>
                        <lx:UserQueryOperand type="Const" expectedValueSpecification="Guid" name="IdExport" />
                    </lx:Criterion>
                </lx:Criteria>
            </condition>
        </lx:CriterionExists>
    </lx:Criteria>
</lx:Criteria>', true, 12, (select UserID from VCLib.T_USERS limit 1), 'Основной', false, null
union select gen_random_uuid(), '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Benefits" />
            <lx:StepString name="EhrRusSdo8u3n5ro" />
        </lx:Path>
        <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
    </lx:Criterion>
    <lx:Criteria type="Or">
        <lx:Criterion type="=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="DateOfDeclusion" />
            </lx:Path>
            <lx:Null />
        </lx:Criterion>
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="DateOfDeclusion" />
            </lx:Path>
            <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
        </lx:Criterion>
    </lx:Criteria>
    <lx:Criterion type="&lt;=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="DateOfInclusion" />
        </lx:Path>
        <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="ActualDate" />
    </lx:Criterion>
</lx:Criteria>', true, 12, (select UserID from VCLib.T_USERS limit 1), 'Первичная выгрузка', true, null
union select gen_random_uuid(), '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion type="=">
        <lx:Case>
            <When>
                <lx:Criteria type="And">
                    <lx:Criterion type="&gt;=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="LastEditDate" />
                        </lx:Path>
                        <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
                    </lx:Criterion>
                    <lx:CriterionChildExists>
                        <condition>
                            <lx:Criterion not="1" type="=">
                                <lx:Path OwnerQueryLevel="0">
                                    <lx:StepString name="Benefits" />
                                    <lx:StepString name="EhrRusSdo8u3n5ro" />
                                </lx:Path>
                                <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
                            </lx:Criterion>
                        </condition>
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="PalliativeRegisterDatas" />
                        </lx:Path>
                    </lx:CriterionChildExists>
                </lx:Criteria>
            </When>
            <Then>
                <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
            </Then>
            <When>
                <lx:CriterionChildExists>
                    <condition>
                        <lx:Criteria type="And">
                            <lx:Criterion not="1" type="=">
                                <lx:Path OwnerQueryLevel="0">
                                    <lx:StepString name="Benefits" />
                                    <lx:StepString name="EhrRusSdo8u3n5ro" />
                                </lx:Path>
                                <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
                            </lx:Criterion>
                            <lx:Criterion type="&gt;=">
                                <lx:Path OwnerQueryLevel="0">
                                    <lx:StepString name="LastEditDate" />
                                </lx:Path>
                                <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
                            </lx:Criterion>
                        </lx:Criteria>
                    </condition>
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="PalliativeRegisterDatas" />
                    </lx:Path>
                </lx:CriterionChildExists>
            </When>
            <Then>
                <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
            </Then>
            <When>
                <lx:CriterionExists entity="RDS.EXPORT_FRLLO_DATA" top="-1" offset="0">
                    <condition>
                        <lx:Criteria type="And">
                            <lx:Criteria type="Or">
                                <lx:Criterion type="=">
                                    <lx:Path OwnerQueryLevel="0">
                                        <lx:StepString name="FrlloStatus" />
                                    </lx:Path>
                                    <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="400" />
                                </lx:Criterion>
                                <lx:Criterion type="=">
                                    <lx:Path OwnerQueryLevel="0">
                                        <lx:StepString name="FrlloStatus" />
                                    </lx:Path>
                                    <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="1" />
                                </lx:Criterion>
                            </lx:Criteria>
                            <lx:Criterion type="=">
                                <lx:Path OwnerQueryLevel="0">
                                    <lx:StepString name="ObjId" />
                                </lx:Path>
                                <lx:Path OwnerQueryLevel="1">
                                    <lx:StepString name="PalliativeRegisterID" />
                                </lx:Path>
                            </lx:Criterion>
                            <lx:Criterion type="=">
                                <lx:Path OwnerQueryLevel="0">
                                    <lx:StepString name="ExportFrllo" />
                                    <lx:StepString name="ExportFrlloID" />
                                </lx:Path>
                                <lx:UserQueryOperand type="Const" expectedValueSpecification="Guid" name="IdExport" />
                            </lx:Criterion>
                        </lx:Criteria>
                    </condition>
                </lx:CriterionExists>
            </When>
            <Then>
                <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
            </Then>
            <Else>
                <lx:ConstOperand type="Boolean">False</lx:ConstOperand>
            </Else>
        </lx:Case>
        <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
    </lx:Criterion>
</lx:Criteria>', true, 13, (select UserID from VCLib.T_USERS limit 1), 'Основной', false, '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Benefits" />
            <lx:StepString name="EhrRusSdo8u3n5ro" />
        </lx:Path>
        <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
    </lx:Criterion>
    <lx:Criteria type="Or">
        <lx:Criterion type="=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="EndDate" />
            </lx:Path>
            <lx:Null />
        </lx:Criterion>
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="EndDate" />
            </lx:Path>
            <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
        </lx:Criterion>
    </lx:Criteria>
    <lx:Criteria type="Or">
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="LastEditDate" />
            </lx:Path>
            <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
        </lx:Criterion>
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="PalliativeRegister" />
                <lx:StepString name="LastEditDate" />
            </lx:Path>
            <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="DateExport" />
        </lx:Criterion>
        <lx:CriterionExists entity="RDS.EXPORT_FRLLO_DATA" top="-1" offset="0">
            <condition>
                <lx:Criteria type="And">
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="ExportFrllo" />
                            <lx:StepString name="ExportFrlloID" />
                        </lx:Path>
                        <lx:UserQueryOperand type="Const" expectedValueSpecification="Guid" name="IdExport" />
                    </lx:Criterion>
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="ObjId" />
                        </lx:Path>
                        <lx:Path OwnerQueryLevel="1">
                            <lx:StepString name="PalliativeRegister" />
                        </lx:Path>
                    </lx:Criterion>
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="Type" />
                        </lx:Path>
                        <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="Type" type="Int32" PrimaryKey="0" />
                    </lx:Criterion>
                    <lx:Criteria type="Or">
                        <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="FrlloStatus" />
                            </lx:Path>
                            <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="400" />
                        </lx:Criterion>
                        <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="FrlloStatus" />
                            </lx:Path>
                            <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="1" />
                        </lx:Criterion>
                    </lx:Criteria>
                </lx:Criteria>
            </condition>
        </lx:CriterionExists>
    </lx:Criteria>
</lx:Criteria>'
union select gen_random_uuid(), '<lx:CriterionChildExists xmlns:lx="lexem">
    <condition>
        <lx:Criteria type="And">
            <lx:Criterion not="1" type="=">
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="Benefits" />
                    <lx:StepString name="EhrRusSdo8u3n5ro" />
                </lx:Path>
                <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
            </lx:Criterion>
            <lx:Criterion type="&lt;=">
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="BeginDate" />
                </lx:Path>
                <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="ActualDate" />
            </lx:Criterion>
            <lx:Criteria type="Or">
                <lx:Criterion type="=">
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="EndDate" />
                    </lx:Path>
                    <lx:Null />
                </lx:Criterion>
                <lx:Criterion type="&gt;=">
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="EndDate" />
                    </lx:Path>
                    <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
                </lx:Criterion>
            </lx:Criteria>
        </lx:Criteria>
    </condition>
    <lx:Path OwnerQueryLevel="0">
        <lx:StepString name="PalliativeRegisterDatas" />
    </lx:Path>
</lx:CriterionChildExists>', true, 13, (select UserID from VCLib.T_USERS limit 1), 'Первичная выгрузка', true, '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Benefits" />
            <lx:StepString name="EhrRusSdo8u3n5ro" />
        </lx:Path>
        <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
    </lx:Criterion>
    <lx:Criteria type="Or">
        <lx:Criterion type="=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="EndDate" />
            </lx:Path>
            <lx:Null />
        </lx:Criterion>
        <lx:Criterion type="&gt;=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="EndDate" />
            </lx:Path>
            <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
        </lx:Criterion>
    </lx:Criteria>
    <lx:Criterion type="&lt;=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="BeginDate" />
        </lx:Path>
        <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="ActualDate" />
    </lx:Criterion>
</lx:Criteria>'
union select gen_random_uuid(), '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Benefit" />
            <lx:StepString name="EhrRusSdo8u3n5ro" />
        </lx:Path>
        <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
    </lx:Criterion>
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Benefit" />
            <lx:StepString name="BenefitViews" />
        </lx:Path>
        <lx:EnumOperand EnumType="BenefitViews" type="Int32" PrimaryKey="19006">
            <Name><![CDATA[По высокозатратным нозологиям]]></Name>
        </lx:EnumOperand>
    </lx:Criterion>
    <lx:Criteria type="Or">
        <lx:Criteria type="And">
            <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="FrlloType" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.RECIPE" AttributeName="FrlloType" isNull="1" />
            </lx:Criterion>
            <lx:Criterion not="1" type="=">
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="Status" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.RECIPE" AttributeName="Status" type="Int32" PrimaryKey="1" />
            </lx:Criterion>
        </lx:Criteria>
        <lx:Criteria type="And">
            <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="FrlloType" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.RECIPE" AttributeName="FrlloType" type="Int32" PrimaryKey="0" />
            </lx:Criterion>
            <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="Status" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.RECIPE" AttributeName="Status" type="Int32" PrimaryKey="1" />
            </lx:Criterion>
        </lx:Criteria>
    </lx:Criteria>
    <lx:Criterion type="&gt;=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="RecipeDate" />
        </lx:Path>
        <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
    </lx:Criterion>
    <lx:Criterion type="&lt;=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="RecipeDate" />
        </lx:Path>
        <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="ActualDate" />
    </lx:Criterion>
</lx:Criteria>', true, 20, (select UserID from VCLib.T_USERS limit 1), 'Основной', false, null
union select gen_random_uuid(), '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Recipe" />
            <lx:StepString name="Benefit" />
            <lx:StepString name="EhrRusSdo8u3n5ro" />
        </lx:Path>
        <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
    </lx:Criterion>
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Recipe" />
            <lx:StepString name="Benefit" />
            <lx:StepString name="BenefitViews" />
        </lx:Path>
        <lx:EnumOperand EnumType="BenefitViews" type="Int32" PrimaryKey="19006">
            <Name><![CDATA[По высокозатратным нозологиям]]></Name>
        </lx:EnumOperand>
    </lx:Criterion>
    <lx:Criteria type="Or">
        <lx:Criteria type="And">
            <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="FrlloType" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.RECIPE_ELEMENT" AttributeName="FrlloType" isNull="1" />
            </lx:Criterion>
            <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="Deleted" />
                </lx:Path>
                <lx:ConstOperand type="Boolean">False</lx:ConstOperand>
            </lx:Criterion>
        </lx:Criteria>
        <lx:Criteria type="And">
            <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="FrlloType" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.RECIPE_ELEMENT" AttributeName="FrlloType" type="Int32" PrimaryKey="0" />
            </lx:Criterion>
            <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="Deleted" />
                </lx:Path>
                <lx:ConstOperand type="Boolean">True</lx:ConstOperand>
            </lx:Criterion>
        </lx:Criteria>
    </lx:Criteria>
    <lx:Criterion type="&gt;=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Recipe" />
            <lx:StepString name="RecipeDate" />
        </lx:Path>
        <lx:ConstOperand type="DateTime">12/01/2020 00:00:00</lx:ConstOperand>
    </lx:Criterion>
    <lx:Criterion type="&lt;=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Recipe" />
            <lx:StepString name="IssueDate" />
        </lx:Path>
        <lx:UserQueryOperand type="Const" expectedValueSpecification="DateTime" name="ActualDate" />
    </lx:Criterion>
</lx:Criteria>', true, 21, (select UserID from VCLib.T_USERS limit 1), 'Основной', false, null
union select gen_random_uuid(), '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="PharmacyDrugDemand" />
            <lx:StepString name="DrugDemand" />
            <lx:StepString name="DrugRequest" />
            <lx:StepString name="DrugRequestID" />
        </lx:Path>
        <lx:UserQueryOperand type="Const" expectedValueSpecification="Guid" name="BaseObjectId" />
    </lx:Criterion>
    <lx:Criterion not="1" type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Benefits" />
            <lx:StepString name="EhrRusSdo8u3n5ro" />
        </lx:Path>
        <lx:BaseObjectOperand Entity="EHR.EHR_RUS_SDO8U3N5RO" isNull="1" />
    </lx:Criterion>
</lx:Criteria>', true, 50, (select UserID from VCLib.T_USERS limit 1), 'Основной', false, null
union select gen_random_uuid(), '<lx:Criteria type="And" xmlns:lx="lexem">
    <lx:Criterion type="=">
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Frllo" />
        </lx:Path>
        <lx:ConstOperand type="Boolean">False</lx:ConstOperand>
    </lx:Criterion>
    <lx:Criteria type="Or">
        <lx:Criterion type="=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="CurrentStatus" />
            </lx:Path>
            <lx:ConstOperand type="Int32">4</lx:ConstOperand>
        </lx:Criterion>
        <lx:Criterion type="=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="CurrentStatus" />
            </lx:Path>
            <lx:ConstOperand type="Int32">6</lx:ConstOperand>
        </lx:Criterion>
        <lx:Criterion type="=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="CurrentStatus" />
            </lx:Path>
            <lx:ConstOperand type="Int32">7</lx:ConstOperand>
        </lx:Criterion>
    </lx:Criteria>
    <lx:CriterionExists not="1" entity="RDS.ELECTRONIC_CERTIFICATE_STATUS" top="-1" offset="0">
        <condition>
            <lx:Criteria type="And">
                <lx:Criterion type="=">
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="ElectronicCertificateApplication" />
                    </lx:Path>
                    <lx:Path OwnerQueryLevel="1">
                        <lx:StepString name="ElectronicCertificateApplication" />
                    </lx:Path>
                </lx:Criterion>
                <lx:Criterion type="&lt;">
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="StatusDateTime" />
                    </lx:Path>
                    <lx:Path OwnerQueryLevel="1">
                        <lx:StepString name="StatusDateTime" />
                    </lx:Path>
                </lx:Criterion>
                <lx:Criterion type="=">
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="Frllo" />
                    </lx:Path>
                    <lx:ConstOperand type="Boolean">False</lx:ConstOperand>
                </lx:Criterion>
                <lx:Criteria type="Or">
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="CurrentStatus" />
                        </lx:Path>
                        <lx:ConstOperand type="Int32">4</lx:ConstOperand>
                    </lx:Criterion>
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="CurrentStatus" />
                        </lx:Path>
                        <lx:ConstOperand type="Int32">6</lx:ConstOperand>
                    </lx:Criterion>
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="CurrentStatus" />
                        </lx:Path>
                        <lx:ConstOperand type="Int32">7</lx:ConstOperand>
                    </lx:Criterion>
                </lx:Criteria>
            </lx:Criteria>
        </condition>
    </lx:CriterionExists>
</lx:Criteria>', true, 60, (select UserID from VCLib.T_USERS limit 1), 'Основной', false, null;

