<template>
  <xc-dialog v-model="props.data.dialog"
             :icon-img="dianzibingli"
             title="电子病历助手"
             width="800px">
    <div style="height: 500px;overflow: auto">
      <div v-for="(value,key) in operation" style="border: 1px solid">
        <button @click="clickToFillInData(value)">填充数据</button>
        <div v-for="(val,ke) in value">
          <div v-if="doNotDisplayArrays(val)">
            {{ ke }}: {{ val }}
          </div>
        </div>
      </div>
    </div>
  </xc-dialog>
</template>

<script setup name='EmrAssistant'>
import XcDialog from "@/components/xiao-chan/dialog/XcDialog";
import dianzibingli from "@/assets/images/dianzibingli.png"

const props = defineProps({
  data: {
    type: Object,
  },
  toFillInData: Function
})

let operation = $ref([])

const clickToFillInData = (value) => {
  props.toFillInData(value)
}

const doNotDisplayArrays = (val) => {
  return !(val instanceof Array)
}

watch(() => props.data.data, () => {
  if (props.data?.data['手术']) {
    operation = props.data?.data['手术']
  }
})


</script>

<style scoped lang="scss">

</style>
