<!--pages/message/message.wxml-->
<wxs src="../../filters/filter.wxs" module="filters"></wxs>
<view class="page">
  <view class="ui-navigatorbar" style="background: #FFFFFF;border-bottom: 1rpx solid #E3E4E5;">
    <view class="ui-title">消息</view>
  </view>
  <view class="toptip" bindtap="goSysMsg" >
    <image src="{{img_host+'/msg_new.png'}}" alt="" class="bell" ></image>
    <view class="msg">
      <view class="titlebox">
        <view class="title">系统消息</view>
        <view class="circle" wx:if="{{systemMsg.count==1}}"></view>
        <view class="bage" wx:elif="{{systemMsg.count>1 && filters.formatNumber(systemMsg.count)}}"> {{filters.formatNumber(systemMsg.count)}} </view>
      </view>
      <view class="tips">{{systemMsg.info.notice_brief_title}}</view>
    </view>

  </view>
  <scroll-view class="scrollbox" scroll-y="true"  bindrefresherrefresh="handleRefresher" refresher-triggered="{{isTriggered}}"	refresher-threshold="100"	refresher-enabled="true">
    <view class="nomsg" hidden="{{conversationList.length>0}}">
      <view class="topdata">
        <view class="nodata">
          <view> 暂时没有</view>
          <view> 问诊记录</view>
        </view>
        <image src="{{img_host+'/nomessage.png'}}"  class="msgicon"></image>
      </view>
      <consult-list consultbox="consultwraper"></consult-list>
    </view>
    <view class="list"   hidden="{{conversationList.length==0}}">
      <view class="listcell" wx:for="{{conversationList}}" wx:key="conversationID" bindtap="goChat" data-custom="{{item.lastMessage.cloudCustomData}}" data-chatid="{{item.userProfile.userID}}" data-count="{{item.unreadCount}}" hidden="{{item.lastMessage.lastTime==0 || !item.lastMessage.cloudCustomData}}">
        <view class="info">
          <image src="{{item.userProfile.avatar}}" class="headicon" wx:if="{{item.userProfile.avatar}}" mode="aspectFill"></image>
          <image src="{{img_host+'/doctor_avatar.png'}}" class="headicon" wx:else></image>
          <view class="right">
            <!-- 1:主任中医师 2:主任医师 3:副主任中医师 4:副主任医师 5:主治医师 6:住院医师 -->
            <view class="name">{{item.userProfile.nick}}医生
            <!-- <text wx:if="{{filters.customString(item.userProfile.profileCustomField,0)==1}}">主任中医师</text>
            <text wx:elif="{{filters.customString(item.userProfile.profileCustomField,0)==2}}">主任医师</text>
            <text wx:elif="{{filters.customString(item.userProfile.profileCustomField,0)==3}}">副主任中医师</text>
            <text wx:elif="{{filters.customString(item.userProfile.profileCustomField,0)==4}}">副主任医师</text>
            <text wx:elif="{{filters.customString(item.userProfile.profileCustomField,0)==5}}">主治医师</text>
            <text wx:elif="{{filters.customString(item.userProfile.profileCustomField,0)==6}}">住院医师</text> -->
            </view>
            <!-- <view class="hospital" wx:if="{{filters.customString(item.userProfile.profileCustomField,1)}}">{{filters.customString(item.userProfile.profileCustomField,1)}}</view> -->
            <!-- <image catchtap="handleConfirm" data-id="{{item.conversationID}}" data-count="{{item.unreadCount}}" src="https://img.applets.igandanyiyuan.com/applet/patient/static/del.png" class="del"></image> -->
          </view>
        </view>
        <view class="persontip" wx:if="{{item.lastMessage.type=='TIMTextElem'}}">{{item.lastMessage.payload.text}}</view>
        <view class="persontip" wx:elif="{{item.lastMessage.type=='TIMCustomElem' && item.lastMessage.cloudCustomData}}">{{filters.formateText(item.lastMessage.payload.data).title}}</view>
        <view class="persontip" wx:elif="{{item.lastMessage.type=='TIMCustomElem' && !item.lastMessage.cloudCustomData}}">[电话]</view>
        <view class="persontip" wx:elif="{{item.lastMessage.type=='TIMImageElem'}}">[图片]</view>
        <view class="persontip" wx:elif="{{item.lastMessage.type=='TIMSoundElem'}}">[语音]</view>
        <view class="bottombox">
          <view class="nameinfo" wx:if="{{item.lastMessage.cloudCustomData}}">
         
            就诊人：<text class="name"> {{filters.formateText(item.lastMessage.cloudCustomData).patient_family_data.patient_name}}</text>（<text decode="true" wx:if="{{filters.formateText(item.lastMessage.cloudCustomData).patient_family_data.patient_sex==1}}">男&nbsp;</text><text decode="true" wx:elif="{{filters.formateText(item.lastMessage.cloudCustomData).patient_family_data.patient_sex==2}}">女&nbsp;</text><text wx:else decode="true">未知&nbsp;</text>|<text decode="true">&nbsp;{{filters.formateText(item.lastMessage.cloudCustomData).patient_family_data.patient_age}}岁）</text>
          </view>
          <view class="nameinfo" wx:else>
        
          {{filters.formateText((filters.formateText(item.lastMessage.payload.data).data.userData.patient_family_data.patient_name))}}
            <!-- 就诊人：<text class="name"> {{(filters.formateText(filters.formateText(item.lastMessage.payload.data).data)).userData.patient_family_data.patient_name}}
            </text>
             -->
            （<text decode="true" wx:if="{{filters.formateText(item.lastMessage.cloudCustomData).patient_family_data.patient_sex==1}}">男&nbsp;</text><text decode="true" wx:elif="{{filters.formateText(item.lastMessage.cloudCustomData).patient_family_data.patient_sex==2}}">女&nbsp;</text><text wx:else decode="true">未知&nbsp;</text>|<text decode="true">&nbsp;{{filters.formateText(item.lastMessage.cloudCustomData).patient_family_data.patient_age}}岁）</text>
          </view>
          <view class="date">{{filters.transforDay(item.lastMessage.lastTime,"dateminute")}}</view>
        </view>
        <view class="circle" wx:if="{{item.unreadCount==1}}"></view>
        <view class="bage" wx:elif="{{ item.unreadCount>1 && filters.formatNumber(item.unreadCount)}}"> {{filters.formatNumber(item.unreadCount)}} </view>
      </view>
    </view>
  </scroll-view>
</view>
<dialog bind:confirm="confirm" showDialog="{{show}}" message="确定删除该会话？"></dialog>