<template>
  <div class="table">
    <el-table
      v-loading="loading"
      class="search-table"
      :data="tData"
      style="width: 100%"
      :height="tableHeight"
      border
    >
      <el-table-column
        prop="diagnoseLogId"
        label="ID"
        min-width="100"
        align="center"
      />
      <el-table-column
        prop="orderNo"
        label="订单ID"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="diagnoseTypeStr"
        label="预约类型"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="statusStr"
        label="状态"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="crrsName"
        label="招募人"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="operateUserName"
        label="运营人员"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="patientName"
        label="患者姓名"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="idCard"
        label="证件号"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="patientMobilePhone"
        label="患者电话"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="userName"
        label="助诊医生"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="userMobile"
        label="助诊电话"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="doctorName"
        label="接诊医生"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="doctorMobile"
        label="接诊电话"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="userMobile"
        label="期望时间"
        min-width="200"
        align="center"
      >
        <template slot-scope="scope">
          <p>{{ scope.row.userAppointBeginTime }}</p>
          <p>{{ scope.row.userAppointEndTime }}</p>
        </template>
      </el-table-column>
      <el-table-column
        prop="userMobile"
        label="预约时间"
        min-width="200"
        align="center"
      >
        <template slot-scope="scope">
          <p>{{ scope.row.appointBeginTime }}</p>
          <p>{{ scope.row.appointEndTime }}</p>
        </template>
      </el-table-column>
      <el-table-column
        prop="diagnoseStageStr"
        label="初/复诊"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="determineFlagStr"
        label="是否确诊"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="diagnoseDisease"
        label="确诊疾病"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="illnessDetail"
        label="病情描述"
        min-width="200"
        align="center"
        show-overflow-tooltip
      />
      <el-table-column
        prop="diagnoseAdvice"
        label="诊断建议"
        min-width="200"
        align="center"
        show-overflow-tooltip
      />
      <el-table-column
        prop="followFlagStr"
        label="是否跟进"
        min-width="200"
        align="center"
      />
      <el-table-column
        prop="drugFollow"
        label="药品跟进"
        min-width="200"
        align="center"
        show-overflow-tooltip
      />
      <el-table-column
        prop="checkFollow"
        label="检查跟进"
        min-width="200"
        align="center"
        show-overflow-tooltip
      />
      <el-table-column
        prop="otherFollow"
        label="其他跟进事项"
        min-width="200"
        align="center"
        show-overflow-tooltip
      />
      <el-table-column
        prop="createTypeStr"
        label="创建方式"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="appointSourceStr"
        label="预约来源"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="createdTime"
        label="创建时间"
        min-width="200"
        align="center"
      />
      <el-table-column
        prop="operateTime"
        label="匹配时间"
        min-width="200"
        align="center"
      />
      <el-table-column
        prop="doneTime"
        label="完成时间"
        min-width="200"
        align="center"
      />
      <el-table-column
        prop="price"
        label="问诊价格"
        min-width="150"
        align="center"
      >
        <template slot-scope="scope">
          <span>{{ scope.row.price | priceFilter }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="payTypeStr"
        label="支付方式"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="sexStr"
        label="性别"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="maritalStatusStr"
        label="婚否"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="age"
        label="年龄"
        min-width="150"
        align="center"
      />
      <el-table-column
        prop="idCardTypeStr"
        label="证件类型"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="userTitle"
        label="助诊医生职称"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="userHospital"
        label="助诊医生所在机构"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="userDepartment"
        label="助诊医生所在科室"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="patientRelationStr"
        label="与患者关系"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="doctorTitle"
        label="接诊医生职称"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="doctorHospital"
        label="接诊医生所在机构"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="doctorDepartment"
        label="接诊医生所在科室"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="doctorSourceStr"
        label="接诊医生来源"
        min-width="170"
        align="center"
      />
      <el-table-column
        prop="serviceFee"
        label="接诊医生服务费"
        min-width="150"
        align="center"
      >
        <template slot-scope="scope">
          <span>{{ scope.row.serviceFee | priceFilter }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="remark"
        label="备注"
        min-width="200"
        align="center"
        show-overflow-tooltip
      />
      <el-table-column
        label="操作"
        fixed="right"
        align="center"
        min-width="200"
      >
        <template slot-scope="scope">
          <!-- 1 初始状态  2待咨询 3 咨询中  4已结束 -->
          <div v-if="scope.row.operateUserID">
            <el-button
              v-if="scope.row.status != 4 && scope.row.status != 5"
              type="primary"
              size="small"
              style="margin-top: 10px;"
              @click="timeHandle(scope.row)"
            >
              修改时间
            </el-button>
            <el-button
              v-if="scope.row.status == 3"
              type="primary"
              size="small"
              style="margin-top: 10px;"
              @click="endDiagnosis(scope.row)"
            >
              结束
            </el-button>
          </div>
          <div v-if="scope.row.operateUserID">
            <!-- <el-button v-if="scope.row.status == 3 && scope.row.imStatus == 1 && scope.row.diagnoseType != 3" type="primary" size="small" @click="callAll(scope.row)" style="margin-top: 10px;">呼叫双方</el-button> -->
            <!-- <el-button v-if="scope.row.status == 3 && scope.row.imStatus == 2 && scope.row.diagnoseType != 3" type="primary" size="small" @click="jionCommunicate(scope.row)" style="margin-top: 10px;">加入问诊</el-button> -->
            <el-button
              v-if="scope.row.status == 3 && scope.row.diagnoseType != 3 && scope.row.appointBeginTime && scope.row.appointEndTime"
              type="primary"
              size="small"
              style="margin-top: 10px;"
              @click="jionCommunicate(scope.row)"
            >
              加入问诊
            </el-button>
            <el-button
              v-if="!((scope.row.status==2 || scope.row.status==4) && scope.row.createType == 2)"
              type="primary"
              size="small"
              style="margin-top: 10px;"
              @click="sendMessage(scope.row)"
            >
              发送消息
            </el-button>
          </div>
          <div v-if="!scope.row.operateUserID">
            <el-button
              v-if="scope.row.status != 5"
              type="primary"
              size="small"
              @click="selectBtn(scope.row)"
            >
              匹配
            </el-button>
          </div>
          <el-button
            v-if="scope.row.status == 2 || scope.row.status == 3"
            type="primary"
            size="small"
            style="margin-top: 10px;"
            @click="cancelBtn(scope.row)"
          >
            取消预约
          </el-button>
          <div>
            <el-button
              v-if="scope.row.status != 5"
              type="primary"
              size="small"
              style="margin-top: 10px;"
              @click="goEditor(scope.row,1)"
            >
              编辑
            </el-button>
            <el-button
              type="primary"
              size="small"
              style="margin-top: 10px;"
              @click="goEditor(scope.row,2)"
            >
              预约详情
            </el-button>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <div class="pagination">
      <el-pagination
        background
        :current-page="pageNo"
        :page-sizes="[15, 30, 50, 100, 150, 200]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="totalRows"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </div>
  </div>
</template>

<script>
  export default {
    props: {
      tData: {
        type: Array,
        default: []
      },
      pageNo: {
        type: Number,
        default: 1
      },
      pageSize: {
        type: Number,
        default: 20
      },
      totalRows: {
        type: Number,
        default: 0
      },
      loading : {
        type: Boolean,
        default: false
      },
      tableHeight: {
        type: Number,
        default: 500
      }
    },
    data() {
      return {

      };
    },
    methods: {
      timeHandle(row) {
        this.$emit('timeHandle', row);
      },
      endDiagnosis(row) {
        this.$emit('endDiagnosis', row);
      },
      callAll(row) {
        this.$emit('callAll', row);
      },
      jionCommunicate(row) {
        this.$emit('jionCommunicate', row);
      },
      sendMessage(row) {
        this.$emit('sendMessage', row);
      },
      selectBtn(row) {
        this.$emit('selectBtn', row);
      },
      cancelBtn(row) {
        this.$emit('cancelBtn', row);
      },
      goEditor(row, flag) {
        this.$emit('goEditor', row, flag);
      },
      handleSizeChange(value) {
        this.$emit('handleSizeChange', value);
      },
      handleCurrentChange(value) {
        this.$emit('handleCurrentChange', value);
      }
    },
  };
</script>

<style>
</style>
