<template>
  <div style="height: 5%"/>
  <div style="height: 95%">
    <el-auto-resizer>
      <template #default="{ height, width }">
        <xc-table-v3 :height="height"
                     :columns="columns"
                     :data="list"/>
      </template>
    </el-auto-resizer>
  </div>
</template>

<script setup name='EmrYzTemperature' lang="tsx">
import {Ref, ref, h, onMounted} from "vue";
import {getYzTemperature} from "@/api/zhu-yuan-yi-sheng/emr-patient";
import EmrDrawer from "@/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrDrawer.vue";
import XcTableV3 from "@/components/xiao-chan/xc-table-v3/XcTableV3.vue";
import {XcColumn} from "@/components/xiao-chan/xc-table-v3/XcColumn";
import {ElButton} from "element-plus";
import {xcMessage} from '@/utils/xiaochan-element-plus'
import {patInfo} from './emr-tools-store'

const columns: XcColumn[] = [
  {
    title: '操作',
    fixed: 'left',
    width: 60,
    cellRenderer: ({row}) => {
      return h(ElButton,
          {
            title: '复制护理措施及效果',
            onClick: (e) => {
              e.stopPropagation()
              if (row.otherInfo) {
                window.localStorage.setItem("clipBoardData",
                    JSON.stringify({
                      content: [{type: 'text', data: row.otherInfo}],
                      plainText: row.otherInfo,
                    }))
                xcMessage.success('复制成功。')
              }
            }
          },
          () => h('span', '复制')
      )
    }
  },
  {
    key: 'otherInfo',
    title: '护理措施及效果',
    width: 250,
    fixed: 'left'
  },
  {
    key: 'tempDate',
    title: '时间',
    width: 150
  },
  {
    key: 'temperature1',
    title: '体温',
    width: 40
  },
  {
    key: 'pulse1',
    title: '心率/脉搏(次/min)',
    width: 90
  },
  {
    key: 'breathe1',
    title: '呼吸',
    width: 90
  },
  {
    key: 'Sp02 %',
    title: 'spo2',
    width: 90
  },
  {
    key: '意识',
    title: 'mind',
    width: 90
  },
  {
    key: 'skin',
    title: '皮肤',
    width: 90
  },
  {
    key: 'userid',
    title: '护士签名',
    width: 90
  },
  {
    title: '血压 ',
    width: 90,
    children: [
      {title: 'AM', key: 'pressure1Am'},
      {title: 'PM', key: 'pressure1Pm'}
    ]
  },
  {
    key: 'tubesName',
    title: '管道名称',
    width: 90
  },
  {
    key: 'tubesStatus',
    title: '管道情况',
    width: 90
  },

]

const drawer: Ref<boolean> = ref(false)
const list: Ref<Array<any>> = ref([])

const query = () => {
  getYzTemperature(patInfo.value.inpatientNo, patInfo.value.admissTimes).then(res => {
    drawer.value = true
    list.value = res as any
  })
}

onMounted(() => {
  query()
})
</script>

<style scoped lang="scss">

</style>
