<?xml version="1.0" encoding="utf-8"?>
<Entity 
Schema="AKUZ" 
Name="HOSPITAL_DESTINATION_LEK_COMPONENT" 
Description="Лекарственный компонент назначения" 
PrimaryKey="HospitalDestinationLekComponentID">
  <Fields>
    <Attribute Name="HospitalDestinationLekComponentID" Type="guid" Description="Идентификатор" />
    <Attribute Name="Dosa" Type="float" DefaultFormat="{0:F2}" Description="Доза" NumericPrecision="12" NumericScale="2" />
    <Parent Name="CMnn" Type="PHARM.C_MNN" Description="Международное непатентованное наименование (МНН)" />
    <Parent Name="CTrn" Type="PHARM.C_TRN" Description="Торговое наименование препарата" />
    <Parent Name="DoseView" Type="PHARM.DOSE_VIEW" Description="Единицы измерения" />
    <Parent Name="HospitalDestination" Type="AKUZ.HOSPITAL_DESTINATION" Description="Лечебное назначение" Required="1" />
    <Parent Name="MedicationForms" Type="PHARM.MEDICATION_FORMS" Description="Лекарственные формы" />
    <Parent Name="Procedure" Type="AKUZ.PROCEDURE" Description="Процедуры" />
    <Attribute Name="BaseComponent" Type="bool" Description="Основной компонент назначения" Required="1" />
    <Child Name="DestExecuteDrugBarcodes" Type="AKUZ.DEST_EXECUTE_DRUG_BARCODE" Description="Информация о списании препарата" ChildAttribute="HospitalDestinationLekComponent" />
    <Attribute Name="cName" Type="string" Description="Наименование" />
    <Parent Name="EhrRus9a9g09e8kl" Type="EHR.EHR_RUS_9A9G09E8KL" Description="Узлы СМНН. ЕСКЛП" />
    <Attribute Name="DoseCount" Type="float" Description="Количество доз" />
    <Attribute Name="DoseViewNew" Type="string" Description="Дозировка" />
  </Fields>
  <DbMapping>
    <Table name="T_HOSPITAL_DESTINATION_LEK_COMPONENT">
      <Map Name="HospitalDestinationLekComponentID" Column="HospitalDestinationLekComponentID" />
      <Map Name="Dosa" Column="Dosa" />
      <Map Name="CMnn" Column="CMnn" />
      <Map Name="CTrn" Column="CTrn" />
      <Map Name="DoseView" Column="DoseView" />
      <Map Name="HospitalDestination" Column="HospitalDestination" />
      <Map Name="MedicationForms" Column="MedicationForms" />
      <Map Name="Procedure" Column="Procedure" />
      <Map Name="BaseComponent" Column="BaseComponent" />
      <Map Name="EhrRus9a9g09e8kl" Column="EhrRus9a9g09e8kl" />
      <Map Name="DoseCount" Column="DoseCount" />
      <Map Name="DoseViewNew" Column="DoseViewNew" RefTable="S_DLO_DoseView" />
    </Table>
    <Lexem>
      <Map Name="cName">
        <lx:MathOperator sign="+" xmlns:lx="lexem">
          <lx:Case>
            <When>
              <lx:Criterion not="1" type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="CTrn" />
                </lx:Path>
                <lx:BaseObjectOperand Entity="PHARM.C_TRN" isNull="1" />
              </lx:Criterion>
            </When>
            <Then>
              <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="CTrn" />
                <lx:StepString name="NameRus" />
              </lx:Path>
            </Then>
            <When>
              <lx:Criterion not="1" type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="Procedure" />
                </lx:Path>
                <lx:BaseObjectOperand Entity="AKUZ.PROCEDURE" isNull="1" />
              </lx:Criterion>
            </When>
            <Then>
              <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="Procedure" />
                <lx:StepString name="Name" />
              </lx:Path>
            </Then>
            <Else>
              <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="CMnn" />
                <lx:StepString name="NameRus" />
              </lx:Path>
            </Else>
          </lx:Case>
          <lx:Case>
            <When>
              <lx:Criterion not="1" type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="Procedure" />
                </lx:Path>
                <lx:BaseObjectOperand Entity="AKUZ.PROCEDURE" isNull="1" />
              </lx:Criterion>
            </When>
            <Then>
              <lx:ConstOperand type="String"><![CDATA[]]></lx:ConstOperand>
            </Then>
            <Else>
              <lx:MathOperator sign="+">
                <lx:MathOperator sign="+">
                  <lx:MathOperator sign="+">
                    <lx:MathOperator sign="+">
                      <lx:MathOperator sign="+">
                        <lx:ConstOperand type="String"><![CDATA[ ]]></lx:ConstOperand>
                        <lx:IsNull>
                          <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="MedicationForms" />
                            <lx:StepString name="Name" />
                          </lx:Path>
                          <lx:ConstOperand type="String"><![CDATA[]]></lx:ConstOperand>
                        </lx:IsNull>
                      </lx:MathOperator>
                      <lx:ConstOperand type="String"><![CDATA[ ]]></lx:ConstOperand>
                    </lx:MathOperator>
                    <lx:Lower>
                      <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="Dosa" />
                      </lx:Path>
                    </lx:Lower>
                  </lx:MathOperator>
                  <lx:ConstOperand type="String"><![CDATA[ ]]></lx:ConstOperand>
                </lx:MathOperator>
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="DoseView" />
                  <lx:StepString name="Name" />
                </lx:Path>
              </lx:MathOperator>
            </Else>
          </lx:Case>
        </lx:MathOperator>
      </Map>
    </Lexem>
  </DbMapping>
</Entity>