<template>
    <el-popover :width="0">
        <template #reference>
            <el-button>
                结果回报
            </el-button>
        </template>

        <el-button v-for="item in requiteList" @click="createAnObject(item.code)">
            {{ item.name }}
        </el-button>

    </el-popover>

</template>

<script setup name='EmrResultReturns'>
import {emrMitt} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init";


const requiteList = [
    {name: 'CT检查结果', code: 'CT检查结果'},
    {name: '磁共振检查结果', code: '磁共振检查结果'},
    {name: '病理结果', code: '病理结果'},
    {name: '细菌培养结果', code: '细菌培养结果'},
]

const createAnObject = (name) => {
    let editor = emrMitt.emit('editor');
    if (editor == null) return

    editor.execute('insertContents', {
        value: [
            {
                type: 'smarttext',
                tips: name,
                element: {code: {business: name, internal: '', dataElement: ''}, name: name, type: 'element'}
            },
        ], isPuzzlepiece: true, defaultValue: ''
    })

}

</script>

<style scoped lang="scss">

</style>
