<!--pages/home/home.wxml-->
<t-navbar title="云管家" />
<scroll-view class="page-scroll__container" type="list" scroll-y style="{{containerStyle}}">
  <view class="header-container">
    <view class="user-info-wrapper" wx:if="{{patient}}">
      <image class="container-bg-image" src="../../assets/bg/user-info.bg.png" mode="aspectFit" />
      <block>
        <image class="user-icon" src="../../assets/icon/gender-{{patient.sex}}.icon.png" mode="aspectFit" />
        <text class="user-name">{{patient.name}}</text>
        <text class="user-age">{{patient.age}}岁</text>
        <text wx:if="{{false}}" class="user-description" overflow="fade" max-lines="1"></text>
        <image wx:if="{{patients.length > 1}}" class="user-select-icon" src="../../assets/icon/arrows-down.icon.png" mode="aspectFit" />
      </block>
    </view>
  </view>
  <body-model dataset="{{healthReport.data}}" bind:position="onBodyModel">
    <view wx:for="{{healthIndex.data}}" wx:key="*this">
      <text max-lines="1" overflow="ellipsis">{{item}}</text>
    </view>
  </body-model>
  <view class="banner-wrapper">
    <image class="container-bg-image" src="../../assets/bg/home-banner.bg.png" mode="widthFix" bind:tap="toChatsPage"></image>
  </view>
  <view class="health-scheme-wrapper">
    <report-health-scheme dataset="{{healthReport.data.conditProgram}}" mark:id="{{healthId}}" bind:tap="toSchemePage"></report-health-scheme>
  </view>
</scroll-view>

<view class="fab-wrapper" bind:tap="onFabTap">
  <view class="fab fab-1" bind:tap="toHealthPage"><text>健康</text><text>档案</text></view>
  <view class="fab fab-2"><text>中医</text><text>科普</text></view>
  <view class="fab fab-3"><text>中医</text><text>茶饮</text></view>
  <view class="fab fab-4"><text>药膳</text><text>查询</text></view>
  <image class="fab-main" src="../../assets/icon/fab.png" mode="aspectFill" />
</view>

<draggable-sheet class="draggable-sheet-wrapper" style="height: {{container.height}}px;" initial-child-size="0" min-child-size="0" max-child-size="1" snap="{{true}}" snap-sizes="{{[0.5]}}">
  <scroll-view class="scrollable draggable-sheet-container" type="custom" scroll-y associative-container="draggable-sheet" show-scrollbar="{{false}}" bounces="{{false}}">
    <sticky-section>
      <sticky-header>
        <view class="draggable-sheet-bar">
          <view class="indicator" />
        </view>
      </sticky-header>
      <block wx:if="{{position.LT}}">
        <view class="card-wrapper" wx:for="{{position.LT}}" wx:key="*this">
          <t-cell wx:if="{{item.title}}" t-class="card-header cell-border-gradient" title="{{item.title}}" />
          <view wx:if="{{item.description}}" class="card-body">{{item.description}}</view>
        </view>
      </block>
      <block wx:if="{{position.RB}}">
        <view class="card-wrapper">
          <t-cell t-class="card-header cell-border-gradient" title="中医证型解释" description="{{position.RB.diagnoseSyndromeSummary}}" />
          <view class="card-body">
            <view class="row" wx:for="{{position.RB.diagnoseSyndromes}}" wx:key="*this">
              <view class="primary">{{item.diagnoseSyndromeName}}</view>
              <view style="margin-top: 4px;">{{item.diagnoseSyndromeAnalysis}}</view>
            </view>
          </view>
        </view>
        <view class="card-wrapper">
          <t-cell t-class="card-header cell-border-gradient" title="中医证素解释" description="{{position.RB.factorItemSummary}}" />
          <view class="card-body">
            <view class="row" wx:for="{{position.RB.factorItems}}" wx:key="*this">
              <view class="primary">{{item.factorItemName}}</view>
              <view style="margin-top: 4px;">{{item.factorItemDescription}}</view>
            </view>
          </view>
        </view>
      </block>
      <block wx:if="{{position.RT}}">
        <view class="card-wrapper">
          <t-cell t-class="card-header cell-border-gradient" title="{{position.RT.constitutionGroupName}}" />
          <view class="card-body">
            <span class="row">
              <text>{{position.RT.constitutionGroupName}}是</text>
              <text>{{position.RT.constitutionGroupDefinition}}</text>
            </span>
          </view>
        </view>
        <view class="card-wrapper">
          <t-cell t-class="card-header cell-border-gradient" title="舌象解释" description="{{position.RT.tongueAnalysisResult}}" />
          <view class="picture-wrapper">
            <image src="{{position.RT.upImg}}" mode="aspectFit" />
            <image src="{{position.RT.downImg}}" mode="aspectFit" />
          </view>
        </view>
        <view class="card-wrapper">
          <t-cell t-class="card-header cell-border-gradient" title="面象解释" description="{{position.RT.faceAnalysisResult}}" />
          <view class="picture-wrapper">
            <image src="{{position.RT.faceImg}}" mode="aspectFit" />
          </view>
        </view>
      </block>
      <view class="bottom-wrapper">
        <form-button index="1" bind:tap="hideDraggableSheet">确定</form-button>
      </view>
    </sticky-section>
  </scroll-view>
</draggable-sheet>