<?xml version="1.0" encoding="utf-8"?>
<Entity 
Schema="AKUZ" 
Name="TEMPERATURE_LIST" 
Description="Температурный лист" 
Inherits="AKUZ.HOSPITAL_RECORD">
  <Fields>
    <Attribute Name="Temperature" Index="12110003" Type="float" DefaultFormat="{0:F1}" Description="Температура" NumericPrecision="3" NumericScale="1" />
    <Attribute Name="Pulse" Index="12110004" Type="int" Description="Пульс" />
    <Attribute Name="SysPresure" Index="12110006" Type="int" Description="Систолическое давление" />
    <Attribute Name="DiaPresure" Index="12110007" Type="int" Description="Диастолическое давление" />
    <Attribute Name="Presure" Index="12110008" Type="string" Description="Давление" />
    <Choice Name="Inspection" Index="12110005" Description="Время осмотра">
      <Item Name="Утро" Index="0" />
      <Item Name="Вечер" Index="1" />
      <Item Name="Ночь" Index="2" />
      <Item Name="День" Index="3" />
    </Choice>
    <Choice Name="DayPeriod" Description="Период дня осмотра">
      <Item Name="Утро" Index="0" />
      <Item Name="Вечер" Index="1" />
      <Item Name="Ночь" Index="2" />
      <Item Name="День" Index="3" />
    </Choice>
    <Attribute Name="Bath" Type="bool" Description="Ванна" />
    <Attribute Name="Chair" Type="bool" Description="Стул" />
    <Attribute Name="DailyUrine" Type="int" Description="Суточное количество мочи" />
    <Attribute Name="DrunkLiquid" Type="int" Description="Выпито жидкости" />
    <Attribute Name="RespiratoryRate" Type="int" Description="Частота дыхательных движений" NumericPrecision="2" NumericScale="0" />
    <Attribute Name="BMI" Type="float" DefaultFormat="{0:F3}" Description="Масса тела" NumericPrecision="3" NumericScale="1" />
    <Attribute Name="ExaminationTime" Type="datetime" Description="Время сбора данных" />
    <Attribute Name="Saturation" Type="int" Description="Сатурация" />
  </Fields>
  <DbMapping>
    <Table name="T_TEMPERATURE_LIST">
      <Map Name="Temperature" Column="Temperature" />
      <Map Name="Pulse" Column="Pulse" />
      <Map Name="SysPresure" Column="SysPresure" />
      <Map Name="DiaPresure" Column="DiaPresure" />
      <Map Name="Inspection" Column="Inspection" />
      <Map Name="Bath" Column="Bath" />
      <Map Name="Chair" Column="Chair" />
      <Map Name="DailyUrine" Column="DailyUrine" />
      <Map Name="DrunkLiquid" Column="DrunkLiquid" />
      <Map Name="RespiratoryRate" Column="RespiratoryRate" />
      <Map Name="BMI" Column="BMI" />
      <Map Name="ExaminationTime" Column="ExaminationTime" />
      <Map Name="Saturation" Column="Saturation" />
    </Table>
    <Lexem>
      <Map Name="Presure">
        <lx:Format xmlns:lx="lexem">
          <lx:ConstOperand type="String"><![CDATA[{0}/{1}]]></lx:ConstOperand>
          <lx:Path OwnerQueryLevel="0" xmlns:lx="lexem">
            <lx:StepInt index="12110006" />
          </lx:Path>
          <lx:Path OwnerQueryLevel="0" xmlns:lx="lexem">
            <lx:StepInt index="12110007" />
          </lx:Path>
        </lx:Format>
      </Map>
      <Map Name="DayPeriod">
        <lx:Case xmlns:lx="lexem">
          <When>
            <lx:Criterion type="=">
              <lx:Path OwnerQueryLevel="0">
                <lx:StepString name="ExaminationTime" />
              </lx:Path>
              <lx:ConstOperand isNull="1" />
            </lx:Criterion>
          </When>
          <Then>
            <lx:Path OwnerQueryLevel="0">
              <lx:StepString name="Inspection" />
            </lx:Path>
          </Then>
          <Else>
            <lx:Case>
              <When>
                <lx:Criteria type="And">
                  <lx:Criterion type="&gt;=">
                    <lx:DatePart datepart="Hour">
                      <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="ExaminationTime" />
                      </lx:Path>
                    </lx:DatePart>
                    <lx:ConstOperand type="Int32">0</lx:ConstOperand>
                  </lx:Criterion>
                  <lx:Criterion type="&lt;">
                    <lx:DatePart datepart="Hour">
                      <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="ExaminationTime" />
                      </lx:Path>
                    </lx:DatePart>
                    <lx:ConstOperand type="Int32">4</lx:ConstOperand>
                  </lx:Criterion>
                </lx:Criteria>
              </When>
              <Then>
                <lx:ConstOperand type="Decimal">2</lx:ConstOperand>
              </Then>
              <Else>
                <lx:Case>
                  <When>
                    <lx:Criteria type="And">
                      <lx:Criterion type="&gt;=">
                        <lx:DatePart datepart="Hour">
                          <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="ExaminationTime" />
                          </lx:Path>
                        </lx:DatePart>
                        <lx:ConstOperand type="Int32">4</lx:ConstOperand>
                      </lx:Criterion>
                      <lx:Criterion type="&lt;">
                        <lx:DatePart datepart="Hour">
                          <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="ExaminationTime" />
                          </lx:Path>
                        </lx:DatePart>
                        <lx:ConstOperand type="Int32">12</lx:ConstOperand>
                      </lx:Criterion>
                    </lx:Criteria>
                  </When>
                  <Then>
                    <lx:ConstOperand type="Decimal">0</lx:ConstOperand>
                  </Then>
                  <Else>
                    <lx:Case>
                      <When>
                        <lx:Criteria type="And">
                          <lx:Criterion type="&gt;=">
                            <lx:DatePart datepart="Hour">
                              <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="ExaminationTime" />
                              </lx:Path>
                            </lx:DatePart>
                            <lx:ConstOperand type="Int32">12</lx:ConstOperand>
                          </lx:Criterion>
                          <lx:Criterion type="&lt;">
                            <lx:DatePart datepart="Hour">
                              <lx:Path OwnerQueryLevel="0">
                                <lx:StepString name="ExaminationTime" />
                              </lx:Path>
                            </lx:DatePart>
                            <lx:ConstOperand type="Int32">17</lx:ConstOperand>
                          </lx:Criterion>
                        </lx:Criteria>
                      </When>
                      <Then>
                        <lx:ConstOperand type="Decimal">3</lx:ConstOperand>
                      </Then>
                      <Else>
                        <lx:ConstOperand type="Decimal">1</lx:ConstOperand>
                      </Else>
                    </lx:Case>
                  </Else>
                </lx:Case>
              </Else>
            </lx:Case>
          </Else>
        </lx:Case>
      </Map>
    </Lexem>
  </DbMapping>
</Entity>