<?xml version="1.0" encoding="utf-8"?>
<Entity 
Schema="AKUZ" 
Name="RECIPE" 
Description="Базовая сущность для льготных рецептов" 
Inherits="AKUZ.RECIPE_BASE">
  <Fields>
    <Attribute Name="CustomDrug" Index="6320018" Type="string" Description="Препарат не из справочников" />
    <Attribute Name="DrugFormCode" Index="6320027" Type="bigint" Description="Код формы выпуска лекарственного средства" />
    <Attribute Name="ReasonOfExcess" Index="6320039" Type="string" Description="Причина превышения" CharacterMaximumLength="256" />
    <Attribute Name="StringNumber" Index="6320042" Type="string" Description="Последний распечатанный штрихкод" CharacterMaximumLength="2000" />
    <Attribute Name="DopFin" Index="6320044" Type="bool" Description="Доп. финансирование" Required="1" />
    <Attribute Name="UnitsCount" Index="6320011" Type="float" DefaultFormat="{0:0.#####}" Description="Количество единиц" NumericPrecision="7" NumericScale="3" Required="1" />
    <Attribute Name="Signa" Index="6320014" Type="string" Description="Рекомендации по применению" />
    <Attribute Name="Doses" Index="6320023" Type="float" Description="Количество доз" />
    <Attribute Name="Weigth" Index="6320024" Type="float" Description="Вес" />
    <Attribute Name="Volume" Index="6320025" Type="float" Description="Объем" />
    <Attribute Name="TakingDuration" Index="6320030" Type="int" Description="Продолжительность приема" />
    <Attribute Name="TakingCountPerDay" Index="6320031" Type="int" Description="Кол-во приемов в день" />
    <Attribute Name="UnitsCountPerTaking" Index="6320032" Type="float" DefaultFormat="{0:0.#####}" Description="Кол-во единиц на 1 прием" />
    <Attribute Name="IsMI" Index="6320037" Type="bool" Description="Медицинское изделие" Required="1" />
    <Attribute Name="DoseViewCode" Index="6320043" Type="int" Description="код ед. изм. дозировки" />
    <Attribute Name="Dose" Index="6730001" Type="string" Description="Доза" />
    <Attribute Name="DoseView" Index="6730003" Type="string" Description="ед. изм. дозировки" />
    <Attribute Name="DoseCount" Index="6730004" Type="int" Description="Количество доз в упаковке" />
    <Parent Name="VolumeView" Index="6320021" Type="PHARM.DOSE_VIEW" Description="ед. изм. объема" />
    <Parent Name="WeightView" Index="6320026" Type="PHARM.DOSE_VIEW" Description="ед. изм. веса" />
    <Parent Name="MedicationForms" Index="6730002" Type="PHARM.MEDICATION_FORMS" Description="Лекарственные формы" />
    <Parent Name="Pharmacy" Index="6320020" Type="AKUZ.PHARMACY" Description="Аптека" />
    <Parent Name="Benefits" Index="6320022" Type="AKUZ.BENEFITS" Description="Льготы" Required="1" />
    <Parent Name="LpuSettings" Index="6320029" Type="AKUZ.LPU_SETTINGS" Description="Настройка МО" />
    <Choice Name="Discount" Index="6320012" Description="Процент финансирования">
      <Item Name="100%" Index="1" />
      <Item Name="50%" Index="2" />
    </Choice>
    <Choice Name="Palliativ" Description="Признак паллиативности" Required="1">
      <Item Name="Нет" Index="0" />
      <Item Name="Да(льготник)" Index="1" />
      <Item Name="Да(отказник)" Index="2" />
    </Choice>
    <Parent Name="EhrRusD4U765T5TH" Type="EHR.EHR_RUS_D4U765T5TH" Description="Пути введения лекарственных препаратов, в том числе для льготного обеспечения граждан лекарственными средствами" />
    <Attribute Name="RegFin" Type="bool" Description="Региональный бюджет" Required="1" />
    <Attribute Name="FedFin" Type="bool" Description="Федеральный бюджет - СД" Required="1" />
  </Fields>
  <DbMapping>
    <Table name="T_RECIPE">
      <Map Name="CustomDrug" Column="CustomDrug" />
      <Map Name="DrugFormCode" Column="DrugFormCode" />
      <Map Name="ReasonOfExcess" Column="ReasonOfExcess" />
      <Map Name="StringNumber" Column="StringNumber" />
      <Map Name="DopFin" Column="DopFin" />
      <Map Name="UnitsCount" Column="UnitsCount" />
      <Map Name="Signa" Column="Signa" />
      <Map Name="Doses" Column="Doses" />
      <Map Name="Weigth" Column="Weigth" />
      <Map Name="Volume" Column="Volume" />
      <Map Name="TakingDuration" Column="TakingDuration" />
      <Map Name="TakingCountPerDay" Column="TakingCountPerDay" />
      <Map Name="UnitsCountPerTaking" Column="UnitsCountPerTaking" />
      <Map Name="IsMI" Column="IsMI" />
      <Map Name="Dose" Column="Dose" />
      <Map Name="DoseCount" Column="DoseCount" />
      <Map Name="VolumeView" Column="VolumeView" />
      <Map Name="WeightView" Column="WeightView" />
      <Map Name="MedicationForms" Column="MedicationForms" />
      <Map Name="Pharmacy" Column="Pharmacy" />
      <Map Name="Benefits" Column="Benefits" />
      <Map Name="LpuSettings" Column="LpuSettings" />
      <Map Name="Discount" Column="Discount" />
      <Map Name="Palliativ" Column="Palliativ" />
      <Map Name="EhrRusD4U765T5TH" Column="EhrRusD4U765T5TH" />
      <Map Name="RegFin" Column="RegFin" />
      <Map Name="FedFin" Column="FedFin" />
    </Table>
    <Lexem>
      <Map Name="DoseViewCode">
        <lx:Case xmlns:lx="lexem">
          <When>
            <lx:Criterion type="IS">
              <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="ObjectTypeID" />
              </lx:Path>
              <lx:ConstOperand type="String"><![CDATA[AKUZ.RECIPE_FEDERAL]]></lx:ConstOperand>
            </lx:Criterion>
          </When>
          <Then>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepAs as="AKUZ.RECIPE_FEDERAL" />
              <lx:StepString name="RFDoseView" />
              <lx:StepString name="Code" />
            </lx:Path>
          </Then>
          <When>
            <lx:Criterion type="IS">
              <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="ObjectTypeID" />
              </lx:Path>
              <lx:ConstOperand type="String"><![CDATA[AKUZ.RECIPE_REGIONAL]]></lx:ConstOperand>
            </lx:Criterion>
          </When>
          <Then>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepAs as="AKUZ.RECIPE_REGIONAL" />
              <lx:StepString name="RRDoseView" />
              <lx:StepString name="Code" />
            </lx:Path>
          </Then>
          <Else>
            <lx:ConstOperand type="Int32">0</lx:ConstOperand>
          </Else>
        </lx:Case>
      </Map>
      <Map Name="DoseView">
        <lx:Case xmlns:lx="lexem">
          <When>
            <lx:Criterion type="IS">
              <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="ObjectTypeID" />
              </lx:Path>
              <lx:ConstOperand type="String"><![CDATA[AKUZ.RECIPE_FEDERAL]]></lx:ConstOperand>
            </lx:Criterion>
          </When>
          <Then>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepAs as="AKUZ.RECIPE_FEDERAL" />
              <lx:StepString name="RFDoseView" />
              <lx:StepString name="Name" />
            </lx:Path>
          </Then>
          <When>
            <lx:Criterion type="IS">
              <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="ObjectTypeID" />
              </lx:Path>
              <lx:ConstOperand type="String"><![CDATA[AKUZ.RECIPE_REGIONAL]]></lx:ConstOperand>
            </lx:Criterion>
          </When>
          <Then>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepAs as="AKUZ.RECIPE_REGIONAL" />
              <lx:StepString name="RRDoseView" />
              <lx:StepString name="Name" />
            </lx:Path>
          </Then>
          <When>
            <lx:Criterion type="IS">
              <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="ObjectTypeID" />
              </lx:Path>
              <lx:ConstOperand type="String"><![CDATA[AKUZ.RECIPE_GENERAL]]></lx:ConstOperand>
            </lx:Criterion>
          </When>
          <Then>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepAs as="AKUZ.RECIPE_GENERAL" />
              <lx:StepString name="RGDoseView" />
            </lx:Path>
          </Then>
          <Else>
            <lx:ConstOperand isNull="1" />
          </Else>
        </lx:Case>
      </Map>
    </Lexem>
  </DbMapping>
</Entity>