<!--module/health/pages/report/report.wxml-->
<wxs module="tool">
module.exports = {
  replace : function (value) {
    if (typeof value === 'string') return value.replace(':', '').replace('：', '');
    return ''
  },
}
</wxs>
<view class="report-container">
  <t-navbar title="{{i18n.report.title}}" left-arrow bind:fail="toHomePage" />

  <scroll-view class="page-scroll__container" type="list" scroll-y style="{{containerStyle}}">
    <view class="card-wrapper">
      <t-cell t-class="card-header no-body {{schemeId ? '' : 'cell-border-gradient'}}" bordered="{{!schemeId}}" style="background:transparent">
        <view slot="title" class="header-row">
          <view class="date-text"><text style="color:#8C8C8C">{{i18n.report.date}}</text><text style="color:black">{{dataset.reportTime}}</text></view>
          <view bind:tap="toSchemePage" class="recuperate-btn" wx:if="{{!!schemeId}}">{{i18n.scheme.title}}</view>
        </view>
      </t-cell>
      <view class="card-body notification-wrapper" wx:if="{{!schemeId && showScheme}}">
        <text style="padding-right: 10px;font-size:16px">请找{{i18n.common.doctor}}</text> <text style="font-size:20px">获取{{i18n.common.zy}}{{i18n.report.scheme}}</text>
      </view>
    </view>

    <view class="card-wrapper">
      <view class="card-body report-wrapper">
        <view class="content-wrapper">
          <block wx:if="dataset">
            <block wx:for="{{dataset.report}}" wx:key="value">
              <span class="row" wx:if="{{item.value}}">
                <text wx:if="{{item.label}}" class="{{index ? 'label-title' : 'label-text'}}">{{i18n.health.statusTable[index]}}</text>
                <text class="{{index ? 'value-title' : 'value-text'}}">{{item.value}}</text>
              </span>
            </block>
          </block>
        </view>
        <image class="image-wrapper" src="../../assets/image/health-report.png" mode="aspectFill" />
      </view>
    </view>

    <view class="card-wrapper">
      <view class="card-body constitution-container">
        <view class="card-title">
          <view>
            <image src="../../assets/icon/icon_physique@2x.png" class="icon-title" />
          </view>
          <view class="text-title">{{i18n.report.physique}}</view>
        </view>
        <view class="content-wrapper">
          <block wx:if="dataset">
            <view class="result-box">
              <image src="../../assets/image/pic_body@2x.png" class="body-image" mode="widthFix" />
              <text class="result-text">{{dataset.result}}</text>
              <view>
              </view>
            </view>
          </block>
          <view class="talbel-wrapper">
            <view class="talbel-row {{index % 2 === 0 ? 'odd-row' : ''}}" wx:for="{{dataset.physique}}" wx:key="value">
              <view class="label">{{i18n.report.physiqueTable[index]}}</view>
              <view class="value">{{item.value}}</view>
            </view>
          </view>
        </view>
      </view>
    </view>

    <card-analysis-content tongue="{{dataset.tongue}}" face="{{dataset.face}}" simple="{{ {tongue: false, face: true} }}"  :type="file">
    </card-analysis-content>

    <view class="card-wrapper">
      <view class="card-body constitution-container">
        <view class="card-title">
          <view> 
            <image src="../../assets/icon/icon_zhengsu@2x.png" class="icon-title" />
          </view>
          <view class="text-title">{{i18n.common.zy}}{{tool.replace(i18n.health.statusTable[5])}}</view>
        </view>
        <view class="rows" wx:for="{{dataset.factorItems}}" wx:key="*this">
          <view class="primary">{{item.factorItemName}}</view>
          <view style="margin-top: 4px;" wx:if="{{item.factorItemDescription}}">&emsp;&emsp;{{item.factorItemDescription}}</view>
        </view>
      </view>
    </view>
    <view class="card-wrapper">
      <view class="card-body constitution-container">
        <view class="card-title">
          <view>
            <image src="../../assets/icon/icon_zhengxing@2x.png" class="icon-title" />
          </view>
          <view class="text-title">{{i18n.common.zy}}{{tool.replace(i18n.health.statusTable[6])}}</view>
        </view>
        <view class="rows" wx:for="{{dataset.diagnoseSyndromes}}" wx:key="*this">
          <view class="primary">{{item.diagnoseSyndromeName}}</view>
          <view style="margin-top: 4px;" wx:if="{{item.diagnoseSyndromeAnalysis}}">&emsp;&emsp;{{item.diagnoseSyndromeAnalysis}}</view>
        </view>
      </view>
    </view>

    <report-health-index dataset="{{healthIndex.data}}" loading="{{healthIndex.loading}}" message="{{healthIndex.message}}">
    </report-health-index>
  </scroll-view>
</view>
<t-message id="{{$messageId}}"></t-message>
<popup-user-auth scene="{{switchType}}" bind:loaded="load" bind:message="openMessage"></popup-user-auth>