<template>
  <div class="patient-container">
    <fast-inspection-sidebar :id="patientID"></fast-inspection-sidebar>
    <fast-upload-inspectiton-detail  :id="patientID"  :class='panelClass'></fast-upload-inspectiton-detail>
  </div>
</template>

<script>

  import { fetchAllList } from "@/api/patient";
  import FastInspectionSidebar from './FastInspectionSidebar'
  import FastUploadInspectitonDetail from './FastUploadInspectitonDetail'

  export default {
    name: 'FastInspectionDetail',
    components: { FastUploadInspectitonDetail, FastInspectionSidebar },
    data() {
      return {
        patientID: 1,
        panelClass: 'patient-app-container',
        patientInfo: {
          id: 0
        }
      }
    },
    created() {
      const id = this.$route.query && this.$route.query.id
      this.patientID = parseInt(id)

      if (isNaN(this.patientID) || this.patientID <= 0) {
        this.getList(1)
      }else{

        this.getList(2)
      }
    },methods:{
      getList(type) {
        fetchAllList().then(response => {
          if (response.data.state == 1) {
            this.patientsList = response.data.data.patients;
            if (type == 1){
              this.patientID =  this.patientsList[0].id
            }else{
              this.patientID = this.$route.query.id
            }
          }
        });
      },

    }

  }
</script>

