<?xml version="1.0" encoding="utf-8"?>
<Entity 
Schema="AKUZ" 
Name="HOSPITAL_DESTINATION_LEK_COMPONENT" 
Description="Лекарственный компонент назначения" 
PrimaryKey="HospitalDestinationLekComponentID" 
DNAttributes="{Name}" 
DisplayName="{0}">
  <Customs>
    <Custom Name="NotDisplayedInFilter" Value="cName" />
    <Custom Name="NotDisplayedColumns" Value="cName" />
    <Custom Name="NotTrackedAttributes" Value="cName" />
  </Customs>
  <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" DefaultFormat="{0:F2}" Description="Количество доз" NumericPrecision="12" NumericScale="2" />
    <Attribute Name="DoseViewNew" Type="string" Description="Дозировка" />
    <Parent Name="PrgDevice" Type="AKUZ.PRG_DEVICE" Description="Диагностический аппарат" />
    <Attribute Name="Methodology" Type="string" Description="Методика" CharacterMaximumLength="2048" />
    <Parent Name="EhrRusDgu0h3gbk1" Type="EHR.EHR_RUS_DGU0H3GBK1" Description="Анатомические локализации" />
    <Parent Name="AppointmentPackageType" Type="PHARM.PACKAGE_TYPE" Description="Вид упаковки" />
    <Attribute Name="AppointmentVolume" Type="float" DefaultFormat="{0:F2}" Description="Количество вещества" NumericPrecision="12" NumericScale="2" />
    <Parent Name="TreatmentRegimenLinkMedicament" Type="AKUZ.TREATMENT_REGIMEN_LINK_MEDICAMENT" Description="Связка элемента схемы лечения с медикаментом" />
    <Attribute Name="cNameWithOutDose" Type="string" Description="Наименование без дозировки" />
    <Attribute Name="Name" Type="string" Description="Наименование" CharacterMaximumLength="1024" />
  </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" />
      <Map Name="PrgDevice" Column="PrgDevice" />
      <Map Name="Methodology" Column="Methodology" />
      <Map Name="EhrRusDgu0h3gbk1" Column="EhrRusDgu0h3gbk1" />
      <Map Name="AppointmentPackageType" Column="AppointmentPackageType" />
      <Map Name="AppointmentVolume" Column="AppointmentVolume" />
      <Map Name="TreatmentRegimenLinkMedicament" Column="TreatmentRegimenLinkMedicament" />
      <Map Name="Name" Column="Name" />
    </Table>
    <Lexem>
      <Map Name="cName">
        <lx:Path OwnerQueryLevel="0" xmlns:lx="lexem">
          <lx:StepString name="Name" />
        </lx:Path>
      </Map>
      <Map Name="cNameWithOutDose">
        <lx:Case xmlns:lx="lexem">
          <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>
      </Map>
    </Lexem>
  </DbMapping>
  <CalculatingAttributes>
    <Attribute Name="DoseLexem" Type="string" Description="Вычислимая дозировка" RequiredAttributes="{AppointmentPackageType/ShortName};{AppointmentPackageType/Name};{DoseCount};{MedicationForms/PackageType/Name};{MedicationForms/PackageType/ShortName}" />
  </CalculatingAttributes>
</Entity>