<?xml version="1.0" encoding="utf-8"?>
<Entity 
Schema="RDS" 
Name="DIVISION" 
Description="Отделение" 
PrimaryKey="DivisionID" 
DNAttributes="{Name}" 
DisplayName="{0}">
  <Fields>
    <Attribute Name="DivisionID" Index="30020001" Type="guid" Description="Идентификатор" />
    <Attribute Name="Name" Index="30020002" Type="string" Description="Наименование" CharacterMaximumLength="128" Required="1" />
    <Attribute Name="Code" Index="30020003" Type="string" Description="Код" CharacterMaximumLength="16" Required="1" />
    <Attribute Name="FullName" Index="30020004" Type="string" Description="Полное наименование" CharacterMaximumLength="256" Required="1" />
    <Attribute Name="Level" Index="30020005" Type="int" Description="Уровень" />
    <Attribute Name="CodeMz" Index="30020006" Type="string" Description="Код МЗ" CharacterMaximumLength="16" Required="1" />
    <Attribute Name="Nofilet" Index="30020007" Type="string" Description="Телефон отделения" CharacterMaximumLength="30" />
    <Attribute Name="Adress" Index="30020008" Type="string" Description="Адрес" />
    <Attribute Name="IDNumberCard" Index="30020012" Type="int" Description="ID для нумерации карт" />
    <Attribute Name="IsActive" Index="30020016" Type="bool" Description="Активное" Required="1" />
    <Attribute Name="ID" Index="30020017" Type="guid" Description="ID" />
    <Parent Name="Branch" Index="30020009" Type="RDS.BRANCH" Description="Филиал" Required="1" />
    <Child Name="DivisionLinkStructureBeds" Index="30020013" Type="RDS.DIVISION_LINK_STRUCTURE_BED" Description="Связь отделений и профилей коек" ChildAttribute="Division" />
    <Choice Name="DivisionType" Index="30020014" Description="Тип отделения" Required="1">
      <Item Name="Поликлиническое" Index="0" />
      <Item Name="Круглосуточный стационар" Index="1" />
      <Item Name="Диагностическое" Index="2" />
      <Item Name="Вспомогательное" Index="3" />
      <Item Name="Женская консультация" Index="4" />
      <Item Name="Реанимационное отделение" Index="5" />
      <Item Name="Приемное отделение" Index="6" />
      <Item Name="Дневной стационар(поликлиника)" Index="7" />
      <Item Name="Дневной стационар на дому" Index="8" />
      <Item Name="Дневной стационар при приемном отделении" Index="9" />
    </Choice>
    <Choice Name="RevenueType" Index="30020015" Description="Источник финансирования">
      <Item Name="через систему ОМС" Index="12900" />
      <Item Name="ОМС" Index="12901" />
      <Item Name="бюджет" Index="12902" />
    </Choice>
  </Fields>
  <DbMapping>
    <Table name="T_DIVISION">
      <Map Name="DivisionID" Column="DivisionID" />
      <Map Name="Name" Column="Name" />
      <Map Name="Code" Column="Code" />
      <Map Name="FullName" Column="FullName" />
      <Map Name="Level" Column="Level" />
      <Map Name="CodeMz" Column="CodeMz" />
      <Map Name="Nofilet" Column="Nofilet" />
      <Map Name="Adress" Column="Adress" />
      <Map Name="IDNumberCard" Column="IDNumberCard" />
      <Map Name="IsActive" Column="IsActive" />
      <Map Name="ID" Column="ID" />
      <Map Name="Branch" Column="Branch" />
      <Map Name="DivisionType" Column="DivisionType" />
      <Map Name="RevenueType" Column="RevenueType" />
    </Table>
  </DbMapping>
  <CalculatingAttributes>
    <Attribute Name="WaitingPeriod" Index="30020020" Type="string" Description="Срок ожидания" RequiredAttributes="{DivisionLinkStructureBeds/FreeBedsInformations/ActualDate}; {DivisionLinkStructureBeds / V020StructureBed/ IDK_PR}">
      <Parameter Name="OnDate" Description="Дата актуальности" Type="date" />
      <Parameter Name="SBcode" Description="Код профиля" Type="int" />
    </Attribute>
    <Parent Name="BedsInprofile" Index="30020010" Type="RDS.AMOUNT_BED" Description="Количество коек в прифиле" RequiredAttributes="{DivisionLinkStructureBeds / AmountBeds / DateEnd};{DivisionLinkStructureBeds / AmountBeds / DateBegin};{DivisionLinkStructureBeds / AmountBeds / BedsCount}; {DivisionLinkStructureBeds / V020StructureBed/ IDK_PR}" PathAttributes="{DivisionLinkStructureBeds / AmountBeds}">
      <Parameter Name="OnDate" Description="Дата актуальности" Type="date" />
      <Parameter Name="SBcode" Description="Код профиля" Type="int" />
    </Parent>
    <Parent Name="cVisitsPlan" Index="30020011" Type="RDS.DIVISION_VISITS_PLAN" Description="План посещений по профилю" RequiredAttributes="{DivisionLinkStructureBeds / VisitsPlans / cTotal};{DivisionLinkStructureBeds / VisitsPlans / Years};" PathAttributes="{DivisionLinkStructureBeds / VisitsPlans}">
      <Parameter Name="Year" Description="Год" Type="int" />
      <Parameter Name="SBcode" Description="Код профиля" Type="int" />
    </Parent>
  </CalculatingAttributes>
</Entity>