<template>
  <div style="overflow: auto;display: flex" :style="{height: props.height + 'px'}">
    <div
        style="width:394.875pt;height:760px;
               border: 1px solid;
               background-color: white;
               font-size: 13px"
        ref="printRef">
      <div style="text-align: center;line-height: 40px;font-size: 20px;">
        泰和医院住院检查报告单
      </div>
      <div>
        <table style="width: 100%;">
          <tbody>
          <tr>
            <td>住院号：{{ props.patInfo.inpatientNo + '_' + props.patInfo.admissTimes }}</td>
            <td>姓名：{{ props.patInfo.name }}</td>
            <td>日期：{{ data.record.checkDate }}</td>
          </tr>
          <tr>
            <td>性别： {{ props.patInfo.sexName }}</td>
            <td>年龄：{{ props.patInfo.age }}</td>
            <td>单号：{{ data.record.hisReqNo }}</td>
          </tr>
          </tbody>
        </table>
      </div>
      <div style="padding: 5px">
        <div>
          检查项目：{{ data.row.orderName }}
        </div>
        <div style="margin-top: 3px">
          <div>
            检查所见：
          </div>
          <div style="border: 1px solid;height: 400px;">
            {{ data.record.checkWhatYouSee }}
          </div>
        </div>

        <div style="margin-top: 3px">
          <div>诊断意见：</div>
          <div style="height: 100px">
            {{ data.record.diagnosticOpinion }}
          </div>
        </div>

        <table style="width: 100%">
          <tbody>
          <tr>
            <td>
              报告医生： {{ data.record.reportName }}
            </td>
            <td>
              报告时间： {{ data.record.reportDate }}
            </td>
          </tr>
          <tr>
            <td>
              审核医生： {{ data.record.confirmName }}
            </td>
            <td>
              审核时间： {{ data.record.confirmDate }}
            </td>
          </tr>
          </tbody>
        </table>
      </div>
    </div>
    <div></div>
    <div>
      <el-button @click="printClick">打印</el-button>
    </div>


  </div>
</template>

<script setup name='JianChaJieGuo'>
import {getLodop} from "@/utils/c-lodop";

const props = defineProps({
  patInfo: {
    type: Object,
    default: {}
  },
  height: {
    type: Number,
    default: 600
  }
})

let data = $ref({
  record: {},
  row: {}
})

const printRef = ref()

const printClick = () => {
  let LODOP = getLodop()
  const strHtml = '<body>' + printRef.value.innerHTML + '</body>'
  LODOP.PRINT_INIT(0, 0, 522, 333, '检验结果')
  LODOP.SET_PRINT_PAGESIZE(1, 0, 0, 'A5')
  LODOP.ADD_PRINT_HTM(0, 0, '100%', '100%', strHtml)
  LODOP.PREVIEW()
}


const fillData = (val) => {
  return new Promise((resolve, reject) => {
    if (data) {
      data = val
      resolve()
    }
  })
}

defineExpose({
  fillData
})

</script>

<style scoped>
.header {

}

</style>
