<template>
  <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
    <div style="padding: 20px; background-color: #fff;">
      患者详情
    </div>
    <div class="my-content" v-if="item!=null">
      <div class="my-title">
        患者信息
      </div>
      <el-descriptions title="" :column="3" border>
        <el-descriptions-item label="患者姓名" >
            <span v-if="item!=null">{{item.patientName}}</span>
        </el-descriptions-item>
        <el-descriptions-item label="身份证号" >
            <span v-if="item!=null">{{item.idCard}}</span>
        </el-descriptions-item>
        <el-descriptions-item label="出生年月" >
            <span v-if="item!=null">{{item.birthday}}</span>
        </el-descriptions-item>
        <el-descriptions-item label="性别" >
            <dict-tag :options="sexOptions" :value="item.sex"/>
        </el-descriptions-item>
        <el-descriptions-item label="手机号" >
            <span v-if="item!=null">{{item.mobile}}</span>
        </el-descriptions-item>
        <el-descriptions-item label="体重G" >
            <span v-if="item!=null">{{item.weight}}</span>
        </el-descriptions-item>
        <el-descriptions-item label="创建时间" >
            <span v-if="item!=null">{{item.createTime}}</span>
        </el-descriptions-item>
      </el-descriptions>
    </div>
    <div class="my-content" v-if="item!=null" >
      <div class="my-title">
        采集信息详情
        <!-- 传入 userId -->
        <collection-detail
          v-if="item.userId"
          :userId="item.userId"
          :prescribeId="0"
        />
      </div>
    </div>
    <div class="my-content" v-if="item!=null" >
        <div class="my-title">
              问诊订单
        </div>
    </div>
    <div class="my-content" v-if="item!=null" >
        <div class="my-title">
              处方单
        </div>
    </div>
</div>
</template>

<script>
import collectionDetail from '@/views/components/collection/collectionDetail.vue';
  import { getPatientByPatientId } from "@/api/patient";
  export default {
    components: {
      collectionDetail // 注册引入的组件
    },
    name: "patientdetails",
    props:["data"],
    data() {
      return {
        sexOptions: [],
        item:null,

      }
    },
    created() {
      this.getDicts("sys_patient_sex").then(response => {
         this.sexOptions = response.data;
       });
    },
    methods: {
      getDetails(patientId) {
          this.item=null;
          getPatientByPatientId(patientId).then(response => {
              this.item = response.data;
          });
      },
    }
  }
</script>
<style lang="scss" scoped>
  .my-content{
      background-color: #fff;
      padding: 20px;
      margin: 20px;
      .my-title{
        margin-bottom: 20px;
        color: #524b4a;
        font-weight: bold;
      }
      .btn-box{
        margin:15px 0px;
        text-align:right;
      }
  }
  .el-descriptions-item__label.is-bordered-label{
    font-weight: normal;
  }
  .el-descriptions-item__content {
    max-width: 500px;
    min-width: 100px;
  }
</style>
