<!--pages/selectPatient/selectPatient.wxml-->
<nav navName="选择患者"></nav>
<view class="contant">
  <view class="contain">
    <view class="card">
      <image src="{{img_host+'/patienthead.png'}}"></image>
      <view class="right">
        <view class="name">请选择患者</view>
        <view class="desc">请如实填写患者信息，辅助医生准确判断病情</view>
      </view>
    </view>
    <view class="personbox">
      <view class="row" wx:for-item="itemName" wx:for="{{family}}" wx:for-index="index" wx:key="index">
        <view class="cell" wx:for-item="item" wx:for="{{itemName}}" wx:key="family_id">
          <view class="cellinner" wx:if="{{!item.type}}" bindtap="selectPatient" data-familyId="{{item.family_id}}" data-sex="{{item.sex}}" data-name="{{item.card_name}}" data-age='{{item.age}}'>
            <view class="person">
              <view class="name">{{item.card_name}}</view>
              <view class="tag" wx:if="{{item.relation==1}}">本人</view>
              <view class="tag" wx:elif="{{item.relation==2}}">父母</view>
              <view class="tag" wx:elif="{{item.relation==3}}">爱人</view>
              <view class="tag" wx:elif="{{item.relation==4}}">子女</view>
              <view class="tag" wx:elif="{{item.relation==5}}">亲戚</view>
              <view class="tag" wx:elif="{{item.relation==6}}">其他</view>
            </view>
            <view class="desc">
              <view class="sex" wx:if="{{item.sex===0}}">性别未知</view>
              <view class="sex" wx:elif="{{item.sex==1}}">男</view>
              <view class="sex" wx:else>女</view>
              <view class="age">{{item.age}}岁</view>
            </view>
            <image  src="{{img_host+'/gou.png'}}"  class="gou" wx:if="{{item.family_id==currentFamilyId}}"></image>
          </view>
          <view class="celladd" bindtap="addPatient" wx:elif="{{item.type}}">
            +新建患者
          </view>
        </view>
      </view>
     
    </view>
  </view>
  <button class="button" plain="true" disabled="{{currentFamilyId?false:true}}" bindtap="handleThrottleNext">
    下一步
  </button>
  <van-popup show="{{ show }}" round closeable position="bottom" custom-style="height:{{height}}rpx" bind:close="onClose">
    <view class="infobox">
      <view class="title">新建患者</view>
      <view class="info">
        <view class="name">真实姓名<text>*</text></view>
        <input value="{{realName}}" type="text" bindinput="inputChange" placeholder="请输入真实姓名" data-id="realName" />
      </view>
      <view class="info">
        <view class="name">身份证号<text>*</text></view>
        <input value="{{idCard}}" type="idcard" bindinput="inputChange"  cursor-spacing="70" placeholder="请输入真实身份证号" data-id="idCard" />
      </view>
      <view class="info">
        <view class="name">联系电话</view>
        <input value="{{phoneNumber}}" type="digit" 	bindblur="onblur"	bindfocus="onfocus" 	cursor-spacing="100" bindinput="inputChange"  placeholder="请输入联系电话" data-id="phoneNumber" />
      </view>
      <view class="info" bindtap="openPicker">
        <view class="name">患者关系</view>
        <input type="text" value="{{relation}}" placeholder="请选择与患者的关系" disabled="true" />
      </view>
      <view class="tip">
        <view class="warntitle">温馨提示：</view>
        <view class="warn">
          <view>1、根据国家卫健委要求,就医实行实名制，请如实填写患者信息。</view>
          <view>2、信息受隐私保护，仅接诊医生可见。
          </view>
          <view>3、6岁以下儿童不支持线上问诊，请到线下就诊。
          </view>
        </view>
      </view>
      <button class="next" bindtap="handleThrottleSick" plain="true">
        确定
      </button>
    </view>
  </van-popup>
  <van-popup show="{{ showPicker }}" round position="bottom" custom-style="height:auto" bind:close="closePicker">
    <van-picker show-toolbar title="选择与患者之间的关系" columns="{{ columns }}" bind:cancel="closePicker" bind:confirm="onConfirm" />
  </van-popup>
</view>