<template>
  <iframe ref="iframeRef" :src="scr" :style="{width: props.width,height:props.height }"/>
</template>

<script setup name='XcPrint'>
import {PrintEmr} from "@/components/xiao-chan/print/xc-print";

const props = defineProps({
  width: {
    type: String
  },
  height: {
    type: String
  },
  categoryId: {
    type: String
  },
  categoryCode: {
    type: String
  }
})

let scr = $ref(`/emr/runtime/?documentId=null&categoryCode=${props.categoryCode}&categoryId=${props.categoryId}&patientId=null#/`)

const iframeRef = ref()
let emr = null

let shuJu = {
  "mattersNeedingAttention": "1.adshioiou \n 2.asdgbhjkg\n",
  "title": "超声检查申请单彩超",
  "reqNo": 4958090,
  "inpatientNo": "0409327",
  "admissTimes": 1,
  "bedNo": "-10",
  "groupName": "甲状旁腺彩超",
  "actOrderNo": 15894685,
  "orderCode": "10257",
  "orderName": "甲状旁腺彩超",
  "pageNo": "4958090",
  "reqComment": "暗杀收到",
  "reqDoctor": "02896",
  "reqDoctorName": "肖蟾",
  "reqDept": "8000007",
  "reqDeptName": "七病室",
  "reqWard": "8000007",
  "execDept": "2020300",
  "execDeptName": null,
  "reqDate": "2022-12-01 15:52:44",
  "inspectPart": null,
  "inspectStuff": null,
  "inspectStuffName": null,
  "sampleStatus": null,
  "printFlag": null,
  "receiveFlag": "1",
  "reqType": "3",
  "resultComment": null,
  "sysDate": "2022-12-01 15:52:44",
  "startTime": "2022-12-01 13:46:45",
  "diagText": "热性中性粒细胞皮肤病\\[斯威特\\]",
  "diagCode": "L98.200",
  "orderType": "02",
  "reportNo": null,
  "jzFlag": null,
  "reqStudyid": null,
  "reqTzComment": "发生的",
  "reqOtherResult": "发生的",
  "receiveJc": null,
  "sex": 1,
  "homeStreet": "湖南省株洲市荷塘区仙庾镇霞山村黄",
  "homeTel": "13973115487     ",
  "responceTypeName": "普通住院",
  "ybSelfFlag": null,
  "receiveFlagName": "申请医技",
  "pbarCode": null,
  "pname": "贺喜安",
  "page": "77岁"
}

const fillData = (data) => {

}

onMounted(async () => {
  await nextTick()
  iframeRef.value.parentElement.emr = new PrintEmr((val) => {
    emr = val
    fillData(shuJu)
  })
  console.log(scr)
})

</script>

<style scoped lang="scss">

</style>
