<?xml version="1.0" encoding="utf-8"?>
<Entity 
Schema="AKUZ" 
Name="PATIENT" 
Description="Пациент" 
PrimaryKey="PatientID" 
DNAttributes="{cFIO}" 
DisplayName="{0}">
  <Customs>
    <Custom Name="NotDisplayedInFilter" Value="cFIO;SickCallBases;Annotation;RegistrationHistorys;Age;ActualBenefits;Accompanys;ObstetricsRisksAnketas;PatientBases;RsoszPndObjects;RsoszHealthObjects;RsoszDocuments" />
    <Custom Name="NotDisplayedColumns" Value="cFIO;SickCallBases;Annotation;RegistrationHistorys;Age;ActualBenefits;Accompanys;ObstetricsRisksAnketas;PatientBases;RsoszPndObjects;RsoszHealthObjects;RsoszDocuments" />
    <Custom Name="NotTrackedAttributes" Value="cFIO;SickCallBases;Annotation;RegistrationHistorys;Age;ActualBenefits;Accompanys;ObstetricsRisksAnketas;PatientBases;RsoszPndObjects;RsoszHealthObjects;RsoszDocuments" />
    <Custom Name="HistoryEntity" Value="AKUZ.PATIENT_HISTORY" />
    <Custom Name="HistoryDependentPaths" Value="{Policys}" />
    <Custom Name="FilterUICondition"><![CDATA[<lx:CriterionChildExists xmlns:lx="lexem">
    <condition>
        <lx:Criterion type="=">
            <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="CardLpu" />
            </lx:Path>
            <lx:ParamHolder>
                <lx:StepString name="CURRENT_LPU_MAIN" />
            </lx:ParamHolder>
        </lx:Criterion>
    </condition>
    <lx:Path OwnerQueryLevel="0">
        <lx:StepString name="AmbulanceCards" />
    </lx:Path>
</lx:CriterionChildExists>]]></Custom>
  </Customs>
  <Fields>
    <Attribute Name="PatientID" Index="5040001" Type="guid" Description="Идентификатор" />
    <Attribute Name="FirstName" Index="5040002" Type="string" Description="Имя" CharacterMaximumLength="40" />
    <Attribute Name="LastName" Index="5040003" Type="string" Description="Фамилия" CharacterMaximumLength="40" />
    <Attribute Name="FatherName" Index="5040004" Type="string" Description="Отчество" CharacterMaximumLength="40" />
    <Attribute Name="DocSeries" Index="5040005" Type="string" Description="Серия документа" CharacterMaximumLength="16" />
    <Attribute Name="DocNumber" Index="5040006" Type="string" Description="Номер документа" CharacterMaximumLength="32" />
    <Attribute Name="FIO" Index="5040014" Type="string" Description="ФИО" />
    <Attribute Name="Birthday" Index="5040015" Type="datetime" DefaultFormat="{0:dd.MM.yyyy}" Description="Дата рождения" Required="1" />
    <Attribute Name="UniqueId" Index="5040016" Type="string" Description="Уникальный код" CharacterMaximumLength="64" />
    <Attribute Name="DocIssueDate" Index="5040021" Type="date" Description="Дата выдачи документа" />
    <Attribute Name="DocIssueOrg" Index="5040022" Type="string" Description="Организация выдавшая документ" CharacterMaximumLength="256" />
    <Attribute Name="PatientIdentifierCode" Index="5040042" Type="string" Description="Идентификационный код пациента" CharacterMaximumLength="16" />
    <Attribute Name="Benefits" Index="5040043" Type="string" Description="Коды льгот через запятую" />
    <Attribute Name="Photo" Index="5040046" Type="binary" Description="Фотография" />
    <Attribute Name="LastCheckPolicysTime" Index="5040047" Type="datetime" DefaultFormat="{0:dd.MM.yyyy HH:mm}" Description="Дата и время последнего поиска полисов" />
    <Attribute Name="VCOneSyncID" Index="5040051" Type="string" Description="Для связи с VC1.0" CharacterMaximumLength="26" />
    <Attribute Name="FIOAccusative" Index="5040054" Type="string" Description="ФИО в дательном падеже" />
    <Attribute Name="Inn" Index="5040061" Type="string" Description="ИНН" CharacterMaximumLength="12" />
    <Attribute Name="Annotation" Index="5040062" Type="string" Description="Комментарий" CharacterMaximumLength="255" />
    <Attribute Name="PolicyOmsNumber" Index="5040071" Type="string" Description="Номер полиса ОМС" />
    <Attribute Name="PlaceOfBirth" Index="5040073" Type="string" Description="Место рождения по паспорту" CharacterMaximumLength="128" />
    <Attribute Name="LastFgDate" Index="5040075" Type="date" Description="Дата последнего флюрографического осмотра" />
    <Attribute Name="NextPrgDate" Index="5040076" Type="date" Description="Дата следующего флюорографического осмотра" />
    <Attribute Name="NumberOfPregnancy" Index="5040077" Type="int" Description="Порядковый номер беременности" />
    <Attribute Name="NumberOfBirths" Index="5040078" Type="int" Description="Порядковый номер родов" />
    <Attribute Name="PregnantAge" Index="5040079" Type="int" Description="Срок беременности" />
    <Attribute Name="ChildNumber" Index="5040080" Type="int" Description="Порядковый номер плода" />
    <Attribute Name="WeightAtBirth" Index="5040081" Type="int" Description="Вес при рождении" />
    <Attribute Name="HeightAtBirth" Index="5040082" Type="int" Description="Рост при рождении" />
    <Attribute Name="PointApgar1" Index="5040084" Type="int" Description="Баллы по шкале Апгар №1" />
    <Attribute Name="PointApgar2" Index="5040085" Type="int" Description="Баллы по шкале Апгар №2" />
    <Parent Name="SNILS" Index="5040007" Type="AKUZ.SNILS" Description="СНИЛС" CharacterMaximumLength="30" />
    <Parent Name="Sex" Index="5040008" Type="VCLib.ENUMS" Description="Пол" EnumType="Sex" Required="1" />
    <Parent Name="DocType" Index="5040009" Type="VCLib.ENUMS" Description="Тип документа" EnumType="DocType" Required="1" />
    <Parent Name="SocialStatus" Index="5040010" Type="AKUZ.SOCIAL_STATUS" Description="Социальное положение" Required="1" />
    <Parent Name="AddressReal" Index="5040017" Type="AKUZ.PATIENT_ADDRESS" Description="Адрес фактический" Required="1" />
    <Parent Name="AddressLegal" Index="5040018" Type="AKUZ.PATIENT_ADDRESS" Description="Адрес по прописке" />
    <Parent Name="OmsPolicy" Index="5040035" Type="AKUZ.OMS_POLICY" Description="Полис ОМС на дату">
      <Parameter Name="OnDate" Description="Дата актуальности" Type="date">
        <lx:ParamHolder xmlns:lx="lexem">
          <lx:StepString name="CURRENT_DATE" />
        </lx:ParamHolder>
      </Parameter>
    </Parent>
    <Parent Name="Registration" Index="5040038" Type="AKUZ.REGISTRATION" Description="Текущее прикрепление">
      <Parameter Name="OnDate" Description="Дата актуальности" Type="date">
        <lx:ParamHolder xmlns:lx="lexem">
          <lx:StepString name="CURRENT_DATE" />
        </lx:ParamHolder>
      </Parameter>
      <Parameter Name="Profile" Description="Профиль прикрепления" Type="int">
        <lx:ConstOperand xmlns:lx="lexem" type="Int32">1</lx:ConstOperand>
      </Parameter>
    </Parent>
    <Parent Name="Birthplace" Index="5040041" Type="AKUZ.BIRTHPLACE" Description="Место рождения" />
    <Parent Name="BloodGroup" Index="5040055" Type="VCLib.ENUMS" Description="Группа крови" EnumType="BloodGroup" />
    <Parent Name="Rhesus_factor" Index="5040056" Type="VCLib.ENUMS" Description="Резус-фактор" EnumType="Rhesus_factor" />
    <Parent Name="DmsPolicy" Index="5040064" Type="AKUZ.DMS_POLICY" Description="Полис ДМС">
      <Parameter Name="OnDate" Description="Дата актуальности" Type="date" />
      <Parameter Name="InsuranceCompanyID" Description="Страховая компания" Type="guid" />
    </Parent>
    <Child Name="Policys" Index="5040013" Type="AKUZ.POLICY" Description="Полисы медицинского страхования" ChildAttribute="Patient" SortingAttr="IssueDate" />
    <Child Name="PatientContingents" Index="5040019" Type="AKUZ.PATIENT_CONTINGENT" Description="Контингенты пациента" ChildAttribute="Patient" />
    <Child Name="PhoneNumbers" Index="5040020" Type="AKUZ.PHONE_NUMBER" Description="Контакты пациента" ChildAttribute="Patient" />
    <Child Name="AmbulanceCards" Index="5040029" Type="AKUZ.AMBULANCE_CARD" Description="Амбулаторные карты" ChildAttribute="Patient" />
    <Child Name="PatientParents" Index="5040032" Type="AKUZ.PATIENT_PARENTS" Description="Родители пациента" ChildAttribute="Patient" />
    <Child Name="PatientJobs" Index="5040033" Type="AKUZ.PATIENT_JOB" Description="Место работы" ChildAttribute="Patient" />
    <Child Name="PatientBenefitss" Index="5040036" Type="AKUZ.PATIENT_BENEFITS" Description="Льготы пациента" ChildAttribute="Patient" />
    <Child Name="Inabilitys" Index="5040037" Type="AKUZ.INABILITY" Description="Инвалидность" ChildAttribute="Patient" />
    <Child Name="Registrations" Index="5040039" Type="AKUZ.REGISTRATION" Description="Прикрепления" ChildAttribute="Patient" SortingAttr="RegistrationDate" />
    <Child Name="AddressHistorys" Index="5040053" Type="AKUZ.ADDRESS_HISTORY" Description="История адресов" ChildAttribute="Patient" />
    <Child Name="PatientSchools" Index="5040057" Type="AKUZ.PATIENT_SCHOOL" Description="Связь со школой" ChildAttribute="Patient" />
    <Child Name="SickCallBases" Index="5040059" Type="AKUZ.SICK_CALL_BASE" Description="Вызовы к больному" ChildAttribute="Patient" />
    <Child Name="Smss" Index="5040065" Type="AKUZ.SMS" Description="Отправленные СМС" ChildAttribute="Patient" />
    <Child Name="RemoteDirections" Index="5040066" Type="AKUZ.REMOTE_DIRECTION" Description="Удаленные направления" ChildAttribute="PatientObj" />
    <Child Name="PatientBenefitsDirections" Index="5040068" Type="AKUZ.PATIENT_BENEFITS_DIRECTION" Description="Направление в Региональный Регистр" ChildAttribute="Patient" />
    <Child Name="RegistrationHistorys" Index="5040074" Type="AKUZ.REGISTRATION_HISTORY" Description="Прикрепление - история изменений" ChildAttribute="Patient" />
    <Child Name="PatientReferences" Index="5040086" Type="AKUZ.PATIENT_REFERENCE" Description="Справки пациента" ChildAttribute="Patient" />
    <Child Name="PatientSmp468s" Index="5040087" Type="AKUZ.PATIENT_SMP468" Description="Социальные статусы по НСИ пациента" ChildAttribute="Patient" />
    <Child Name="PatientSmp369s" Index="5040088" Type="AKUZ.PATIENT_SMP369" Description="Классификатор льготных категорий НСИ для пациента" ChildAttribute="Patient" />
    <Child Name="SpravkaGibdds" Index="5040090" Type="AKUZ.SPRAVKA_GIBDD" Description="Справка о допуске к управлению транспортным средством" ChildAttribute="Patient" />
    <Child Name="IemkIheDocumentEvents" Index="5040093" Type="AKUZ.IEMK_IHE_DOCUMENT_EVENT" Description="Уведомления об отправлении документов на сервер ИЭМК" ChildAttribute="Patient" />
    <Choice Name="FeedingType" Index="5040089" Description="Тип вскармливания">
      <Item Name="Искусственное" Index="1" />
      <Item Name="Смешанное" Index="2" />
      <Item Name="Грудное" Index="3" />
    </Choice>
    <Choice Name="DegreeOfTerm" Index="5040091" Description="Степень доношенности">
      <Item Name="Доношен" Index="0" />
      <Item Name="Недоношен" Index="1" />
      <Item Name="Переношен" Index="2" />
    </Choice>
    <Choice Name="SpecialCase" Index="5040092" IsFlag="1" Description="Особый случай" Required="1">
      <Item Name="1 - отсутствует отчество" Index="1" />
      <Item Name="2 - неизвестно фамилия" Index="2" />
      <Item Name="3 - неизвестно имя" Index="4" />
      <Item Name="4 - известен только месяц и год даты рождения" Index="8" />
      <Item Name="5 - известен только год даты рождения" Index="16" />
      <Item Name="6 - дата рождения не соответствует календарю" Index="32" />
      <Item Name="0 - неидентифицированный пациент" Index="64" />
    </Choice>
    <Link Name="PatientAddInfo" Index="5040060" Type="AKUZ.PATIENT_ADD_INFO" Description="Дополнительная информация о пациенте" LinkAttribute="Patient" />
    <Child Name="ClinicExaminationItems" Index="5040094" Type="AKUZ.CLINIC_EXAMINATION_ITEM" Description="Информация о диспансеризации" ChildAttribute="Patient" />
    <Child Name="DoctorPatientDrugDemands" Index="5040095" Type="AKUZ.DOCTOR_PATIENT_DRUG_DEMAND" Description="Потребность пациента в препарате от врача" ChildAttribute="Patient" />
    <Attribute Name="cFIO" Index="5040040" Type="string" Description="ФИО" />
    <Parent Name="PrgContingent" Index="5040096" Type="AKUZ.PRG_CONTINGENT" Description="Контингент (флюорография)" />
    <Child Name="PatientFieldEditReasons" Type="AKUZ.PATIENT_FIELD_EDIT_REASON" Description="Причина изменения ключевых атрибутов" ChildAttribute="Patient" />
    <Choice Name="MultipleBorn" Description="Показатель многоплодных родов">
      <Item Name="Не указано" Index="0" />
      <Item Name="Да" Index="1" />
      <Item Name="Нет" Index="2" />
    </Choice>
    <Parent Name="SocialProfessionalGroup" Type="EHR.EHR_RUS_BST365" Description="Профессии и основные виды занятий больных злокачественными новообразованиями" />
    <Parent Name="EthnicGroup" Type="AKUZ.ETHNIC_GROUP" Description="Этническая группа" />
    <Link Name="OnkRegistry" Type="AKUZ.ONK_REGISTRY" Description="Онкологический регистр" LinkAttribute="Patient" />
    <Parent Name="EhrRusO00015" Type="EHR.EHR_RUS_O00015" Description="Гражданство" />
    <Link Name="PalliativeRegistry" Type="AKUZ.PALLIATIVE_REGISTRY" Description="Регистр паллиативных больных" LinkAttribute="Patient" />
    <Child Name="IndividualValuations" Type="AKUZ.INDIVIDUAL_VALUATION" Description="Карты сопоставленных работников" ChildAttribute="Patient" />
    <Child Name="BskRegisterRecordss" Type="AKUZ.BSK_REGISTER_RECORDS" Description="Запись в БСК регистре" ChildAttribute="Patient" />
    <Child Name="PlanOfEventss" Type="AKUZ.PLAN_OF_EVENTS" Description="План мероприятий" ChildAttribute="Patient" />
    <Parent Name="BskRegisterRecords" Type="AKUZ.BSK_REGISTER_RECORDS" Description="Запись в БСК регистре" />
    <Child Name="PulmoRegistries" Type="AKUZ.PULMO_REGISTRY" Description="Записи в пульмо регистре" ChildAttribute="Patient" />
    <Attribute Name="RequestSnilsId" Type="GUID" Description="Код запросов у адаптера СМЕВ" />
    <Attribute Name="LegalRegistrationDate" Type="date" Description="Дата регистрации по прописке" />
    <Attribute Name="RealRegistrationDate" Type="date" Description="Дата регистрации по фактическому адресу" />
    <Attribute Name="ActualBenefits" Type="text" Description="Актуальные льготы пациента" />
    <Attribute Name="DocIssueOrgNumber" Type="string" Description="Код подразделения организации выдавшей документ" CharacterMaximumLength="8" />
    <Attribute Name="ENP" Type="string" Description="Единый номер полиса" />
    <Attribute Name="EnrichmentRequestSnilsUri" Type="string" Description="Адрес запросов у сервиса обогащения" />
    <Child Name="PatientIdentityRequests" Type="AKUZ.PATIENT_IDENTITY_REQUEST" Description="Запрос идентификации гражданина (ИП ООГУЗ)" ChildAttribute="Patient" />
    <Child Name="RekEvents" Type="AKUZ.REK_EVENT" Description="Случай работы ВК" ChildAttribute="Patient" />
    <Attribute Name="PreviousLastName" Type="string" Description="Предыдущая фамилия пациента" CharacterMaximumLength="40" />
    <Child Name="PatientRrpRequests" Type="AKUZ.PATIENT_RRP_REQUEST" Description="Запрос регистрации и идентификации пациента в РРП г. Севастополь" ChildAttribute="Patient" />
    <Parent Name="AmbulanceCard" Index="5040031" Type="AKUZ.AMBULANCE_CARD" Description="Амбулаторная карта" />
    <Attribute Name="LastCheckPolicysError" Type="string" Description="Ошибка последнего поиска полисов" CharacterMaximumLength="512" />
    <Child Name="NotificationAboutHospitals" Type="AKUZ.NOTIFICATION_ABOUT_HOSPITAL" Description="Уведомление в стационар о предстоящей госпитализации пациента" ChildAttribute="Patient" />
    <Child Name="RecipeIntakeSchemes" Type="AKUZ.RECIPE_INTAKE_SCHEME" Description="Схема приема препарата" ChildAttribute="Patient" />
    <Child Name="VimisRegisters" Type="AKUZ.VIMIS_REGISTER" Description="Регистр ВИМИС" ChildAttribute="Patient" />
    <Child Name="SportsExaminationPatients" Type="AKUZ.SPORTS_EXAMINATION_PATIENT" Description="Пациент направленный на медосмотр спортивной организацией" ChildAttribute="Patient" />
    <Link Name="CovidRegistryPerson" Type="AKUZ.COVID_REGISTRY_PERSON" Description="Персональная информация пациента в регистре COVID-19" LinkAttribute="Patient" />
    <Choice Name="CellanoGroup" Description="Группа крови Cellano">
      <Item Name="K-" Index="0" />
      <Item Name="K+" Index="1" />
    </Choice>
    <Attribute Name="AdvancedBloodInfo" Type="string" Description="Иные сведения групповой принадлежности крови" />
    <Child Name="Accompanys" Type="AKUZ.ACCOMPANY" Description="Сопровождающий" ChildAttribute="Patient" />
    <Child Name="ObstetricsRisksAnketas" Type="AKUZ.OBSTETRICS_RISKS_ANKETA" Description="Анкета для расчета высоких акушерских рисков" ChildAttribute="Patient" />
    <Attribute Name="MedCertSeries" Type="string" Description="Серия мед.свидетельства о рождении" />
    <Attribute Name="MedCertNumber" Type="string" Description="Номер мед.свидетельства о рождении" />
    <Child Name="RrPatients" Type="AKUZ.RR_PATIENT" Description="Пациент из рег. регистра" ChildAttribute="Patient" />
    <Child Name="PatientAppointmentExecutions" Type="AKUZ.PATIENT_APPOINTMENT_EXECUTION" Description="Выполнение назначения на пациента" ChildAttribute="Patient" />
    <Child Name="PhoneNumberHistorys" Type="AKUZ.PHONE_NUMBER_HISTORY" Description="История изменений контактной информации" ChildAttribute="Patient" />
    <Attribute Name="NSDate" Type="datetime" DefaultFormat="{0:dd.MM.yyyy}" Description="Дата неонатального скрининга" />
    <Attribute Name="NeonatalResult" Type="string" Description="Результат неонатального скрининга" />
    <Child Name="IncapacityPeriods" Type="AKUZ.INCAPACITY_PERIOD" Description="Периоды недееспособности" ChildAttribute="Patient" />
    <Choice Name="DispanserisationInitStatus" IsFlag="1" Description="Состояние диспансерного наблюдения" Required="1">
      <Item Name="Состоит на учете по беременности" Index="1" />
      <Item Name="Состоит на учете по психиатрическому заболеванию" Index="2" />
      <Item Name="Состоит на учете по соматическому заболеванию" Index="4" />
    </Choice>
    <Link Name="ToothCard" Type="AKUZ.TOOTH_CARD" Description="Зубная карта" LinkAttribute="Patient" />
    <Child Name="PatientAttachments" Type="AKUZ.PATIENT_ATTACHMENT" Description="Статусы заявления и результаты его рассмотрения" ChildAttribute="Patient" />
    <Choice Name="Vmcl" IsFlag="1" Description="Профили, на которых состоит пациент">
      <Item Name="ССЗ" Index="1" />
      <Item Name="ОНКО" Index="2" />
      <Item Name="АКИНЕО" Index="4" />
      <Item Name="Профилактика" Index="8" />
      <Item Name="Инфекционные заболевания" Index="16" />
    </Choice>
    <Choice Name="FieldsChangeCharacteristic" IsFlag="1" Description="Характеристика изменения полей данных" Required="1">
      <Item Name="FgDatesChangesIsAutomatic" Index="1" />
    </Choice>
    <Child Name="PatientDrugDemands" Type="AKUZ.PATIENT_DRUG_DEMAND" Description="Потребность пациента в препарате" ChildAttribute="Patient" />
    <Link Name="FrvichPatient" Type="AKUZ.FRVICH_PATIENT" Description="Пациент РВИЧ" LinkAttribute="Patient" />
    <Child Name="PatientBases" Type="AKUZ.AMBULANCE_CARD_RECORD" Description="Медицинские записи пациента" ChildAttribute="PatientBase" />
    <Link Name="MVDPatientLink" Type="AKUZ.PATIENT_MVD_LINK" Description="Связь пациента с МВД" LinkAttribute="Patient" />
    <Parent Name="OmsPolicyMapped" Type="AKUZ.OMS_POLICY" Description="Полис ОМС " />
    <Parent Name="PrgRiskGroupDictionary" Type="AKUZ.PRG_RISK_GROUP_DICTIONARY" Description="Группа риска" />
    <Child Name="PalliativeRegistryManipulations" Type="AKUZ.PALLIATIVE_REGISTRY_MANIPULATION" Description="Направление на включение пациента в РПБ" ChildAttribute="Patient" />
    <Child Name="MonitoredRecordss" Type="AKUZ.MONITORED_RECORDS" Description="Записи о постановке пациента на мониторинг" ChildAttribute="Patient" />
    <Attribute Name="BirthEventId" Type="guid" Description="Идентификатор случая рождения" />
    <Child Name="RsoszDocuments" Type="AKUZ.RSOSZ_DOCUMENT" Description="Документ РСОСЗ" ChildAttribute="Patient" />
    <Child Name="RsoszPndObjects" Type="AKUZ.RSOSZ_PND_OBJECT" Description="Обьект PND для РСОСЗ" ChildAttribute="Patient" />
    <Child Name="RsoszHealthObjects" Type="AKUZ.RSOSZ_HEALTH_OBJECT" Description="Обьект HEALTH для РСОСЗ" ChildAttribute="Patient" />
    <Child Name="RehabRegistrys" Type="AKUZ.REHAB_REGISTRY" Description="Регистр реабилитации" ChildAttribute="Patient" />
  </Fields>
  <DbMapping>
    <Table name="T_PATIENT">
      <Map Name="PatientID" Column="PatientID" />
      <Map Name="FirstName" Column="FirstName" />
      <Map Name="LastName" Column="LastName" />
      <Map Name="FatherName" Column="FatherName" />
      <Map Name="DocSeries" Column="DocSeries" />
      <Map Name="DocNumber" Column="DocNumber" />
      <Map Name="FIO" Column="FIO" IsStored="0" />
      <Map Name="Birthday" Column="Birthday" />
      <Map Name="UniqueId" Column="UniqueId" />
      <Map Name="DocIssueDate" Column="DocIssueDate" />
      <Map Name="DocIssueOrg" Column="DocIssueOrg" />
      <Map Name="PatientIdentifierCode" Column="PatientIdentifierCode" />
      <Map Name="Photo" Column="Photo" />
      <Map Name="LastCheckPolicysTime" Column="LastCheckPolicysTime" />
      <Map Name="VCOneSyncID" Column="VCOneSyncID" />
      <Map Name="FIOAccusative" Function="dbo.fn_GetFIOAccusative" />
      <Map Name="Inn" Column="Inn" />
      <Map Name="Annotation" Column="Annotation" />
      <Map Name="PlaceOfBirth" Column="PlaceOfBirth" />
      <Map Name="LastFgDate" Column="LastFgDate" />
      <Map Name="NextPrgDate" Column="NextPrgDate" />
      <Map Name="NumberOfPregnancy" Column="NumberOfPregnancy" />
      <Map Name="NumberOfBirths" Column="NumberOfBirths" />
      <Map Name="PregnantAge" Column="PregnantAge" />
      <Map Name="ChildNumber" Column="ChildNumber" />
      <Map Name="WeightAtBirth" Column="WeightAtBirth" />
      <Map Name="HeightAtBirth" Column="HeightAtBirth" />
      <Map Name="PointApgar1" Column="PointApgar1" />
      <Map Name="PointApgar2" Column="PointApgar2" />
      <Map Name="SNILS" Column="SNILS" />
      <Map Name="Sex" Column="Sex" />
      <Map Name="DocType" Column="DocType" />
      <Map Name="SocialStatus" Column="SocialStatus" />
      <Map Name="AddressReal" Column="AddressReal" />
      <Map Name="AddressLegal" Column="AddressLegal" />
      <Map Name="Birthplace" Column="Birthplace" />
      <Map Name="BloodGroup" Column="BloodGroup" />
      <Map Name="Rhesus_factor" Column="Rhesus_factor" />
      <Map Name="DmsPolicy" Function="dbo.fn_GetDmsPolicy" />
      <Map Name="FeedingType" Column="FeedingType" />
      <Map Name="DegreeOfTerm" Column="DegreeOfTerm" />
      <Map Name="SpecialCase" Column="SpecialCase" />
      <Map Name="PrgContingent" Column="PrgContingent" />
      <Map Name="MultipleBorn" Column="MultipleBorn" />
      <Map Name="SocialProfessionalGroup" Column="SocialProfessionalGroup" />
      <Map Name="EthnicGroup" Column="EthnicGroup" />
      <Map Name="EhrRusO00015" Column="EhrRusO00015" />
      <Map Name="RequestSnilsId" Column="RequestSnilsId" />
      <Map Name="LegalRegistrationDate" Column="LegalRegistrationDate" />
      <Map Name="RealRegistrationDate" Column="RealRegistrationDate" />
      <Map Name="DocIssueOrgNumber" Column="DocIssueOrgNumber" />
      <Map Name="ENP" Column="ENP" />
      <Map Name="EnrichmentRequestSnilsUri" Column="EnrichmentRequestSnilsUri" />
      <Map Name="PreviousLastName" Column="PreviousLastName" />
      <Map Name="LastCheckPolicysError" Column="LastCheckPolicysError" />
      <Map Name="CellanoGroup" Column="CellanoGroup" />
      <Map Name="AdvancedBloodInfo" Column="AdvancedBloodInfo" />
      <Map Name="MedCertSeries" Column="MedCertSeries" />
      <Map Name="MedCertNumber" Column="MedCertNumber" />
      <Map Name="NSDate" Column="NSDate" />
      <Map Name="NeonatalResult" Column="NeonatalResult" />
      <Map Name="DispanserisationInitStatus" Column="DispanserisationInitStatus" />
      <Map Name="FieldsChangeCharacteristic" Column="FieldsChangeCharacteristic" />
      <Map Name="OmsPolicyMapped" Column="OmsPolicyMapped" />
      <Map Name="PrgRiskGroupDictionary" Column="PrgRiskGroupDictionary" />
      <Map Name="BirthEventId" Column="BirthEventId" />
    </Table>
    <Lexem>
      <Map Name="Benefits">
        <lx:MathOperator sign="+" xmlns:lx="lexem">
          <lx:MathOperator sign="+">
            <lx:Cast type="String">
              <lx:IsNull>
                <lx:ChildCount>
                  <condition>
                    <lx:Criteria type="And">
                      <lx:Criterion type="&lt;=">
                        <lx:Path OwnerQueryLevel="0">
                          <lx:StepString name="BeginDate" />
                        </lx:Path>
                        <lx:ParamHolder>
                          <lx:StepString name="CURRENT_DATE" />
                        </lx:ParamHolder>
                      </lx:Criterion>
                      <lx:Criteria type="Or">
                        <lx:Criterion type="=">
                          <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="EndDate" />
                          </lx:Path>
                          <lx:ConstOperand isNull="1" />
                        </lx:Criterion>
                        <lx:Criterion type="&gt;=">
                          <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="EndDate" />
                          </lx:Path>
                          <lx:ParamHolder>
                            <lx:StepString name="CURRENT_DATE" />
                          </lx:ParamHolder>
                        </lx:Criterion>
                      </lx:Criteria>
                      <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                          <lx:StepString name="Benefits" />
                          <lx:StepString name="Private" />
                        </lx:Path>
                        <lx:ConstOperand type="Boolean">False</lx:ConstOperand>
                      </lx:Criterion>
                    </lx:Criteria>
                  </condition>
                  <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="PatientBenefitss" />
                  </lx:Path>
                  <lx:Joint>
                    <lx:Path OwnerQueryLevel="0">
                      <lx:StepString name="Benefits" />
                      <lx:StepString name="BenefitCode" />
                    </lx:Path>
                    <lx:ConstOperand type="String"><![CDATA[,]]></lx:ConstOperand>
                  </lx:Joint>
                </lx:ChildCount>
                <lx:ConstOperand type="String"><![CDATA[]]></lx:ConstOperand>
              </lx:IsNull>
            </lx:Cast>
            <lx:Cast type="String">
              <lx:Case>
                <When>
                  <lx:Criteria type="And">
                    <lx:CriterionChildExists>
                      <condition />
                      <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="SNILS" />
                        <lx:StepString name="FrDocuments" />
                      </lx:Path>
                    </lx:CriterionChildExists>
                    <lx:CriterionChildExists>
                      <condition>
                        <lx:Criteria type="And">
                          <lx:Criterion type="&lt;=">
                            <lx:Path OwnerQueryLevel="0">
                              <lx:StepString name="BeginDate" />
                            </lx:Path>
                            <lx:ParamHolder>
                              <lx:StepString name="CURRENT_DATE" />
                            </lx:ParamHolder>
                          </lx:Criterion>
                          <lx:Criteria type="Or">
                            <lx:Criterion type="=">
                              <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="EndDate" />
                              </lx:Path>
                              <lx:ConstOperand isNull="1" />
                            </lx:Criterion>
                            <lx:Criterion type="&gt;=">
                              <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="EndDate" />
                              </lx:Path>
                              <lx:ParamHolder>
                                <lx:StepString name="CURRENT_DATE" />
                              </lx:ParamHolder>
                            </lx:Criterion>
                          </lx:Criteria>
                          <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                              <lx:StepString name="Benefits" />
                              <lx:StepString name="Private" />
                            </lx:Path>
                            <lx:ConstOperand type="Boolean">False</lx:ConstOperand>
                          </lx:Criterion>
                        </lx:Criteria>
                      </condition>
                      <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="PatientBenefitss" />
                      </lx:Path>
                    </lx:CriterionChildExists>
                  </lx:Criteria>
                </When>
                <Then>
                  <lx:ConstOperand type="String"><![CDATA[,]]></lx:ConstOperand>
                </Then>
                <Else>
                  <lx:ConstOperand type="String"><![CDATA[]]></lx:ConstOperand>
                </Else>
              </lx:Case>
            </lx:Cast>
          </lx:MathOperator>
          <lx:Cast type="String">
            <lx:IsNull>
              <lx:ChildCount>
                <condition />
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="SNILS" />
                  <lx:StepString name="FrDocuments" />
                </lx:Path>
                <lx:Joint>
                  <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="Benefits" />
                    <lx:StepString name="BenefitCode" />
                  </lx:Path>
                  <lx:ConstOperand type="String"><![CDATA[,]]></lx:ConstOperand>
                </lx:Joint>
              </lx:ChildCount>
              <lx:ConstOperand type="String"><![CDATA[]]></lx:ConstOperand>
            </lx:IsNull>
          </lx:Cast>
        </lx:MathOperator>
      </Map>
      <Map Name="PolicyOmsNumber">
        <lx:Path OwnerQueryLevel="0" xmlns:lx="lexem">
          <lx:StepString name="OmsPolicyMapped" />
          <lx:StepString name="Number" />
        </lx:Path>
      </Map>
      <Map Name="OmsPolicy">
        <lx:QueryValue entity="AKUZ.OMS_POLICY" top="1" offset="0" xmlns:lx="lexem">
          <condition>
            <lx:Criteria type="And">
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="Patient" />
                  <lx:StepString name="PatientID" />
                </lx:Path>
                <lx:Path OwnerQueryLevel="1">
                  <lx:StepString name="PatientID" />
                </lx:Path>
              </lx:Criterion>
              <lx:Criterion type="&gt;=">
                <lx:IsNull>
                  <lx:Argument>
                    <lx:ConstOperand type="Int32">0</lx:ConstOperand>
                  </lx:Argument>
                  <lx:ParamHolder>
                    <lx:StepString name="CURRENT_DATE" />
                  </lx:ParamHolder>
                </lx:IsNull>
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="IssueDate" />
                </lx:Path>
              </lx:Criterion>
            </lx:Criteria>
          </condition>
          <orderBy>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepString name="IssueDate" />
            </lx:Path>
            <desc>True</desc>
            <lx:IsNull>
              <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="ValidThrough" />
              </lx:Path>
              <lx:DateAdd datepart="Year">
                <lx:ConstOperand type="Int32">100</lx:ConstOperand>
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="IssueDate" />
                </lx:Path>
              </lx:DateAdd>
            </lx:IsNull>
            <desc>True</desc>
          </orderBy>
          <value>
            <lx:LexemList>
              <lx:Case>
                <When>
                  <lx:Criteria type="Or">
                    <lx:Criterion type="=">
                      <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="ValidThrough" />
                      </lx:Path>
                      <lx:ConstOperand isNull="1" />
                    </lx:Criterion>
                    <lx:Criterion type="&lt;=">
                      <lx:IsNull>
                        <lx:Argument>
                          <lx:ConstOperand type="Int32">0</lx:ConstOperand>
                        </lx:Argument>
                        <lx:ParamHolder>
                          <lx:StepString name="CURRENT_DATE" />
                        </lx:ParamHolder>
                      </lx:IsNull>
                      <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="ValidThrough" />
                      </lx:Path>
                    </lx:Criterion>
                  </lx:Criteria>
                </When>
                <Then>
                  <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="PolicyID" />
                  </lx:Path>
                </Then>
                <Else>
                  <lx:ConstOperand isNull="1" />
                </Else>
              </lx:Case>
            </lx:LexemList>
          </value>
        </lx:QueryValue>
      </Map>
      <Map Name="Registration">
        <lx:QueryValue entity="AKUZ.REGISTRATION" top="1" offset="0" xmlns:lx="lexem">
          <condition>
            <lx:Criteria type="And">
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="Patient" />
                  <lx:StepString name="PatientID" />
                </lx:Path>
                <lx:Path OwnerQueryLevel="1">
                  <lx:StepString name="PatientID" />
                </lx:Path>
              </lx:Criterion>
              <lx:Criterion type="&lt;=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="RegistrationDate" />
                </lx:Path>
                <lx:Argument>
                  <lx:ConstOperand type="Int32">0</lx:ConstOperand>
                </lx:Argument>
              </lx:Criterion>
              <lx:Criterion type="&gt;">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="AttachmentStatus" />
                </lx:Path>
                <lx:ChoiceOperand Entity="AKUZ.REGISTRATION" AttributeName="AttachmentStatus" type="Int32" PrimaryKey="0" />
              </lx:Criterion>
              <lx:Criteria type="Or">
                <lx:Criteria type="And">
                  <lx:Criterion type="IN">
                    <lx:Argument>
                      <lx:ConstOperand type="Int32">1</lx:ConstOperand>
                    </lx:Argument>
                    <lx:LexemList>
                      <lx:ConstOperand type="Int32">1</lx:ConstOperand>
                      <lx:ConstOperand type="Int32">2</lx:ConstOperand>
                    </lx:LexemList>
                  </lx:Criterion>
                  <lx:Criterion type="IN">
                    <lx:Path OwnerQueryLevel="0">
                      <lx:StepString name="Profile" />
                    </lx:Path>
                    <lx:LexemList>
                      <lx:ChoiceOperand Entity="AKUZ.REGISTRATION" AttributeName="Profile" type="Int32" PrimaryKey="1" />
                      <lx:ChoiceOperand Entity="AKUZ.REGISTRATION" AttributeName="Profile" type="Int32" PrimaryKey="2" />
                    </lx:LexemList>
                  </lx:Criterion>
                </lx:Criteria>
                <lx:Criterion type="=">
                  <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="Profile" />
                  </lx:Path>
                  <lx:Argument>
                    <lx:ConstOperand type="Int32">1</lx:ConstOperand>
                  </lx:Argument>
                </lx:Criterion>
              </lx:Criteria>
            </lx:Criteria>
          </condition>
          <orderBy>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepString name="RegistrationDate" />
            </lx:Path>
            <desc>True</desc>
          </orderBy>
          <value>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepString name="RegistrationID" />
            </lx:Path>
          </value>
        </lx:QueryValue>
      </Map>
      <Map Name="cFIO">
        <lx:MathOperator sign="+" xmlns:lx="lexem">
          <lx:MathOperator sign="+">
            <lx:MathOperator sign="+">
              <lx:MathOperator sign="+">
                <lx:IsNull>
                  <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="LastName" />
                  </lx:Path>
                  <lx:ConstOperand type="String"><![CDATA[]]></lx:ConstOperand>
                </lx:IsNull>
                <lx:ConstOperand type="String"><![CDATA[ ]]></lx:ConstOperand>
              </lx:MathOperator>
              <lx:IsNull>
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="FirstName" />
                </lx:Path>
                <lx:ConstOperand type="String"><![CDATA[]]></lx:ConstOperand>
              </lx:IsNull>
            </lx:MathOperator>
            <lx:ConstOperand type="String"><![CDATA[ ]]></lx:ConstOperand>
          </lx:MathOperator>
          <lx:IsNull>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepString name="FatherName" />
            </lx:Path>
            <lx:ConstOperand type="String"><![CDATA[]]></lx:ConstOperand>
          </lx:IsNull>
        </lx:MathOperator>
      </Map>
      <Map Name="BskRegisterRecords">
        <lx:QueryValue entity="AKUZ.BSK_REGISTER_RECORDS" top="1" offset="0" hints="" xmlns:lx="lexem">
          <condition>
            <lx:Criteria type="And">
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="Patient" />
                  <lx:StepString name="PatientID" />
                </lx:Path>
                <lx:Path OwnerQueryLevel="1">
                  <lx:StepString name="PatientID" />
                </lx:Path>
              </lx:Criterion>
              <lx:Criteria type="Or">
                <lx:Criterion type="=">
                  <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="DateEnd" />
                  </lx:Path>
                  <lx:ConstOperand isNull="1" />
                </lx:Criterion>
                <lx:Criterion type="&gt;=">
                  <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="DateEnd" />
                  </lx:Path>
                  <lx:ParamHolder>
                    <lx:StepString name="CURRENT_DATE" />
                  </lx:ParamHolder>
                </lx:Criterion>
              </lx:Criteria>
              <lx:Criterion type="&lt;=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="DateBegin" />
                </lx:Path>
                <lx:ParamHolder>
                  <lx:StepString name="CURRENT_DATE" />
                </lx:ParamHolder>
              </lx:Criterion>
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="ExclusionReason" />
                </lx:Path>
                <lx:ChoiceOperand Entity="AKUZ.BSK_REGISTER_RECORDS" AttributeName="ExclusionReason" type="Int32" PrimaryKey="0" />
              </lx:Criterion>
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="CloseDate" />
                </lx:Path>
                <lx:ConstOperand isNull="1" />
              </lx:Criterion>
            </lx:Criteria>
          </condition>
          <orderBy>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepString name="DateBegin" />
            </lx:Path>
            <desc>True</desc>
          </orderBy>
          <value>
            <lx:LexemList>
              <lx:Path OwnerQueryLevel="0">
                <lx:StepCurrent />
              </lx:Path>
            </lx:LexemList>
          </value>
        </lx:QueryValue>
      </Map>
      <Map Name="ActualBenefits">
        <lx:MathOperator sign="+" xmlns:lx="lexem">
          <lx:MathOperator sign="+">
            <lx:Cast type="String">
              <lx:IsNull>
                <lx:ChildCount>
                  <condition>
                    <lx:Criteria type="And">
                      <lx:Criterion type="&lt;=">
                        <lx:Path OwnerQueryLevel="0">
                          <lx:StepString name="BeginDate" />
                        </lx:Path>
                        <lx:ParamHolder>
                          <lx:StepString name="CURRENT_DATE" />
                        </lx:ParamHolder>
                      </lx:Criterion>
                      <lx:Criteria type="Or">
                        <lx:Criterion type="=">
                          <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="EndDate" />
                          </lx:Path>
                          <lx:ConstOperand isNull="1" />
                        </lx:Criterion>
                        <lx:Criterion type="&gt;=">
                          <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="EndDate" />
                          </lx:Path>
                          <lx:ParamHolder>
                            <lx:StepString name="CURRENT_DATE" />
                          </lx:ParamHolder>
                        </lx:Criterion>
                      </lx:Criteria>
                      <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                          <lx:StepString name="Benefits" />
                          <lx:StepString name="Private" />
                        </lx:Path>
                        <lx:ConstOperand type="Boolean">False</lx:ConstOperand>
                      </lx:Criterion>
                    </lx:Criteria>
                  </condition>
                  <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="PatientBenefitss" />
                  </lx:Path>
                  <lx:Joint>
                    <lx:Path OwnerQueryLevel="0">
                      <lx:StepString name="Benefits" />
                      <lx:StepString name="BenefitName" />
                    </lx:Path>
                    <lx:ConstOperand type="String"><![CDATA[;]]></lx:ConstOperand>
                  </lx:Joint>
                </lx:ChildCount>
                <lx:ConstOperand type="String"><![CDATA[]]></lx:ConstOperand>
              </lx:IsNull>
            </lx:Cast>
            <lx:Cast type="String">
              <lx:Case>
                <When>
                  <lx:Criteria type="And">
                    <lx:CriterionChildExists>
                      <condition />
                      <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="SNILS" />
                        <lx:StepString name="FrDocuments" />
                      </lx:Path>
                    </lx:CriterionChildExists>
                    <lx:CriterionChildExists>
                      <condition>
                        <lx:Criteria type="And">
                          <lx:Criterion type="&lt;=">
                            <lx:Path OwnerQueryLevel="0">
                              <lx:StepString name="BeginDate" />
                            </lx:Path>
                            <lx:ParamHolder>
                              <lx:StepString name="CURRENT_DATE" />
                            </lx:ParamHolder>
                          </lx:Criterion>
                          <lx:Criteria type="Or">
                            <lx:Criterion type="=">
                              <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="EndDate" />
                              </lx:Path>
                              <lx:ConstOperand isNull="1" />
                            </lx:Criterion>
                            <lx:Criterion type="&gt;=">
                              <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="EndDate" />
                              </lx:Path>
                              <lx:ParamHolder>
                                <lx:StepString name="CURRENT_DATE" />
                              </lx:ParamHolder>
                            </lx:Criterion>
                          </lx:Criteria>
                          <lx:Criterion type="=">
                            <lx:Path OwnerQueryLevel="0">
                              <lx:StepString name="Benefits" />
                              <lx:StepString name="Private" />
                            </lx:Path>
                            <lx:ConstOperand type="Boolean">False</lx:ConstOperand>
                          </lx:Criterion>
                        </lx:Criteria>
                      </condition>
                      <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="PatientBenefitss" />
                      </lx:Path>
                    </lx:CriterionChildExists>
                  </lx:Criteria>
                </When>
                <Then>
                  <lx:ConstOperand type="String"><![CDATA[,]]></lx:ConstOperand>
                </Then>
                <Else>
                  <lx:ConstOperand type="String"><![CDATA[]]></lx:ConstOperand>
                </Else>
              </lx:Case>
            </lx:Cast>
          </lx:MathOperator>
          <lx:Cast type="String">
            <lx:IsNull>
              <lx:ChildCount>
                <condition />
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="SNILS" />
                  <lx:StepString name="FrDocuments" />
                </lx:Path>
                <lx:Joint>
                  <lx:Path OwnerQueryLevel="0">
                    <lx:StepString name="Benefits" />
                    <lx:StepString name="BenefitName" />
                  </lx:Path>
                  <lx:ConstOperand type="String"><![CDATA[;]]></lx:ConstOperand>
                </lx:Joint>
              </lx:ChildCount>
              <lx:ConstOperand type="String"><![CDATA[]]></lx:ConstOperand>
            </lx:IsNull>
          </lx:Cast>
        </lx:MathOperator>
      </Map>
      <Map Name="AmbulanceCard" PathAttributes="{AmbulanceCards}">
        <lx:QueryValue entity="AKUZ.AMBULANCE_CARD" top="1" offset="0" xmlns:lx="lexem">
          <condition>
            <lx:Criteria type="And">
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="CardLpu" />
                </lx:Path>
                <lx:ParamHolder>
                  <lx:StepString name="CURRENT_LPU_MAIN" />
                </lx:ParamHolder>
              </lx:Criterion>
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="Patient" />
                  <lx:StepString name="PatientID" />
                </lx:Path>
                <lx:Path OwnerQueryLevel="1">
                  <lx:StepString name="PatientID" />
                </lx:Path>
              </lx:Criterion>
            </lx:Criteria>
          </condition>
          <orderBy>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepString name="CreationDateTime" />
            </lx:Path>
            <desc>True</desc>
          </orderBy>
          <value>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepString name="AmbulanceCardID" />
            </lx:Path>
          </value>
        </lx:QueryValue>
      </Map>
      <Map Name="Incapacity"><![CDATA[begin() {{IncapacityPeriods/BeginDate},{IncapacityPeriods/EndDate}}    foreach (period in {IncapacityPeriods})    begin()            if(@period -> {BeginDate} <= param(CURRENT_DATE) And (@period -> {EndDate} >= param(CURRENT_DATE) Or (@period -> {EndDate} = Null())))        begin()            Return(true);        end;    end;    Return(false);end;]]></Map>
    </Lexem>
  </DbMapping>
  <CalculatingAttributes>
    <Attribute Name="Incapacity" Type="bool" Description="Недееспособен" Required="1" />
    <Attribute Name="Document" Index="5040030" Type="string" Description="Документ" RequiredAttributes="{DocType/Name};{DocSeries};{DocNumber};{DocIssueDate};{DocIssueOrg};{DocIssueOrgNumber}" />
    <Attribute Name="PhoneNumbersString" Index="5040048" Type="string" Description="Телефоны через запятую" RequiredAttributes="{PhoneNumbers/Number};{PhoneNumbers/PhoneType};{PhoneNumbers/AddedBy}">
      <Parameter Name="AddedBy" Description="Кем добавлено" Type="int" />
      <Parameter Name="PhoneType" Description="Тип номера" Type="int" />
    </Attribute>
    <Attribute Name="BenefitDocuments" Index="5040049" Type="string" Description="Документы на льготу" RequiredAttributes="{PatientBenefitss/BenefitDocument};{PatientBenefitss/BenefitDocumentNumber}" />
    <Attribute Name="OnInvalidity" Index="5040050" Type="string" Description="Действующая группа инвалидности" RequiredAttributes="{Inabilitys/BeginDate};{Inabilitys/EndDate};{Inabilitys/Invalidity/Name}">
      <Parameter Name="onDate" Description="Дата актуальности" Type="datetime" />
    </Attribute>
    <Attribute Name="FederalBenefit" Index="5040052" Type="string" Description="Федеральная льгота" RequiredAttributes="{SNILS/FrDocuments/Benefits/BenefitCode};{SNILS/FrRecords/DateNsuBegin};{SNILS/FrRecords/DateNsuEnd};{SNILS/FrRecords/NSU};{SNILS/FrRecords/Nsus};{SNILS/FrRecords/Version};{SNILS/FrRecords/Deleted};{SNILS/FrRecords/DateEnd};{SNILS/FrRecords/DateBegin};{SNILS/FrRecords/UpdateDate}" />
    <Parent Name="PolicyOMS" Index="5040012" Type="AKUZ.OMS_POLICY" Description="Полис ОМС" RequiredAttributes="{Policys/IssueDate};{Policys/ValidThrough}" PathAttributes="{Policys/as AKUZ.OMS_POLICY}">
      <Parameter Name="OnDate" Description="Дата актуальности" Type="datetime" />
    </Parent>
    <Parent Name="Job" Index="5040034" Type="AKUZ.PATIENT_JOB" Description="Место работы/учебы" RequiredAttributes="{PatientJobs/CollaborationWork};{PatientJobs/BeginDate};{PatientJobs/EndDate}" PathAttributes="{PatientJobs}">
      <Parameter Name="OnDate" Description="Дата актуальности" Type="datetime" />
    </Parent>
    <Parent Name="cRegistration" Index="5040045" Type="AKUZ.REGISTRATION" Description="Прикрепление" RequiredAttributes="{Registrations/RegistrationDate};{Registrations/AttachmentStatus};{Registrations/Profile}" PathAttributes="{Registrations}">
      <Parameter Name="OnDate" Description="Дата актуальности" Type="date" />
      <Parameter Name="Profile" Description="Профиль" Type="int" />
    </Parent>
    <Parent Name="Inability" Index="5040058" Type="AKUZ.INABILITY" Description="Текущая инвалидность" RequiredAttributes="{Inabilitys/BeginDate};{Inabilitys/EndDate}" PathAttributes="{Inabilitys}" />
    <Parent Name="PolicyDMS" Index="5040063" Type="AKUZ.DMS_POLICY" Description="Полис ДМС" RequiredAttributes="{Policys/IssueDate};{Policys/ValidThrough}" PathAttributes="{Policys /as AKUZ.DMS_POLICY}">
      <Parameter Name="OnDate" Description="Дата актуальности" Type="datetime" />
    </Parent>
    <Parent Name="CollaborationWork" Index="5040072" Type="AKUZ.PATIENT_JOB" Description="Работа по совместительству" RequiredAttributes="{PatientJobs/CollaborationWork};{PatientJobs/BeginDate};{PatientJobs/EndDate}" PathAttributes="{PatientJobs}" />
    <Parent Name="cCurrentRepresentative" Index="5040083" Type="AKUZ.PATIENT_PARENTS" Description="Текущий представитель" RequiredAttributes="{PatientParents / CurrentRepresentative}" PathAttributes="{PatientParents}" />
    <Child Name="cRegistrations" Index="5040069" Type="AKUZ.REGISTRATION" Description="Текущие прикрепления" ChildAttribute="Patient" RequiredAttributes="{Registrations/RegistrationDate};{Registrations/Status};{Registrations/Profile};{Registrations/AttachmentStatus};{Registrations/State};{Registrations/Cause}" PathAttributes="{Registrations}">
      <Parameter Name="OnDate" Description="Дата актуальности" Type="date" />
      <Parameter Name="ShortList" Description="Короткий список" Type="bool" />
    </Child>
    <Child Name="cPatientBenefitsDirectionDatas" Type="AKUZ.PATIENT_BENEFITS_DIRECTION_DATA" Description="Льготы из направлений в региональные регистры" RequiredAttributes="{PatientBenefitsDirections / PatientBenefitsDirectionDatas}" PathAttributes="{PatientBenefitsDirections / PatientBenefitsDirectionDatas}" />
    <Attribute Name="Age" Type="string" Description="Возраст" RequiredAttributes="{Birthday}">
      <Parameter Name="OnDate" Description="Дата актуальности" Type="datetime" />
    </Attribute>
    <Attribute Name="CheckIdentification" Type="string" Description="Определение статуса пациента для счет-реестра" RequiredAttributes="{OmsPolicy};{FirstName};{LastName};{Birthday};{AddressLegal};{AddressReal};{DocType};{DocSeries};{DocNumber};{DocIssueDate}" />
    <Attribute Name="FIO_Cropped" Type="string" Description="Усеченное ФИО" RequiredAttributes="{LastName};{FirstName};{FatherName}" />
  </CalculatingAttributes>
</Entity>