<template>

  <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
    <div style="padding: 20px; background-color: #fff;">
      档案详情
    </div>
    <div class="contentx" v-if="item!=null">
        <div class="desct">
          档案信息
        </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="状态" ><dict-tag :options="pOptions" :value="item.status"/></el-descriptions-item>
        <el-descriptions-item label="与本人关系" ><span v-if="item!=null">{{item.relation}}</span></el-descriptions-item>
        <el-descriptions-item label="肝功能是否异常" ><span v-if="item!=null">{{item.liverUnusual}}</span></el-descriptions-item>
        <el-descriptions-item label="肾功能是否异常" ><span v-if="item!=null">{{item.renalUnusual}}</span></el-descriptions-item>
        <el-descriptions-item label="过敏史" ><span v-if="item!=null">{{item.historyAllergic}}</span></el-descriptions-item>
        <el-descriptions-item label="家族病史" ><span v-if="item!=null">{{item.familyMedHistory}}</span></el-descriptions-item>
        <el-descriptions-item label="个人病史" ><span v-if="item!=null">{{item.selfMedHistory}}</span></el-descriptions-item>
        <el-descriptions-item label="创建时间" ><span v-if="item!=null">{{item.createTime}}</span></el-descriptions-item>
        <el-descriptions-item label="修改时间" ><span v-if="item!=null">{{item.updateTime}}</span></el-descriptions-item>
        </el-descriptions>
    </div>


<div class="contentx" v-if="item!=null" >
 <div class="desct">
      问诊订单
 </div>
    <userInquiryOrderDetails  ref="InquiryDetails" />
</div>
<div class="contentx" v-if="item!=null" >
 <div class="desct">
      处方单
 </div>
    <userPrescribeDetails  ref="PrescribeDetails" />
</div>
</div>
</template>

<script>
import { listPatient, getPatient, delPatient, addPatient, updatePatient, exportPatient } from "@/api/his/patient";
import {getUser} from "@/api/his/user";
import userInquiryOrderDetails from "../his/userInquiryOrderDetails.vue";
import userPrescribeDetails from "../his/userPrescribeDetails.vue";
  export default {
    name: "patientdetails",
    props:["data"],
     components: { userInquiryOrderDetails,userPrescribeDetails},
    data() {
      return {
        userimg:null,
        userOptions: [],
        sexOptions: [],
        pOptions: [],
        item:null,
        useritem:null,
        form: {
          sreason: '',
        }
      }
    },
    created() {
      this.getDicts("sys_user_status").then(response => {
        this.userOptions = response.data;
      });
      this.getDicts("sys_patient_status").then(response => {
        this.pOptions = response.data;
     });
      this.getDicts("sys_patient_sex").then(response => {
         this.sexOptions = response.data;
       });
    },
    methods: {
      getDetails(orderId) {
          this.item=null;
          getPatient(orderId).then(response => {
              this.item = response.data;
              this.getuserDetails();
              setTimeout(() => {
                   this.$refs.InquiryDetails.getInquiryDetails(orderId,2);
              }, 1);
              setTimeout(() => {
                   this.$refs.PrescribeDetails.PrescribeDetails(orderId);
              }, 1);
          });
      },
      getuserDetails() {
          this.useritem=null;
          getUser(this.item.userId).then(response => {
              this.useritem = response.data;
              this.userimg=response.data.avatar;
          });
      },
    }
  }
</script>
<style>
  .contentx{
      height: 100%;
      background-color: #fff;
      padding: 0px 20px 20px;


      margin: 20px;
  }
  .el-descriptions-item__label.is-bordered-label{
    font-weight: normal;
  }
  .el-descriptions-item__content {
    max-width: 150px;
    min-width: 100px;
  }
  .desct{
      padding-top: 20px;
      padding-bottom: 20px;
      color: #524b4a;
      font-weight: bold;
    }
</style>


