<template>
  <CyDialog title="三级医生设置"
            body-height="max-content"
            :confirm-click="submitToTheThirdLevelDoctor"
            confirm-text="提交"
  >
    <el-form label-width="120px">
      <el-form-item label="患者：">
        {{ name }}
      </el-form-item>
      <el-form-item label="管床医生：">
        <SystemStaffSelect v-model="data"
                           value="referPhysician"
                           label="referPhysicianName"
        />
      </el-form-item>
      <el-form-item label="主治医生：">
        <SystemStaffSelect v-model="data"
                           value="consultPhysician"
                           label="consultPhysicianName"
        />
      </el-form-item>
      <el-form-item label="主任/副主任：">
        <SystemStaffSelect v-model="data"
                           value="deptDirector"
                           label="deptDirectorName"
        />
      </el-form-item>
    </el-form>
  </CyDialog>
</template>

<script setup lang="ts">
import SystemStaffSelect from '@/components/system/staff-select/SystemStaffSelect.vue'
import CyDialog from "@/components/cy/dialog/src/CyDialog.vue";
import {ref} from "vue";
import {saveTheThirdLevelDoctor} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";

const props = defineProps({
  name: String,
  referPhysician: String,
  referPhysicianName: String,
  consultPhysician: String,
  consultPhysicianName: String,
  deptDirector: String,
  deptDirectorName: String,
  inpatientNo: String,
  admissTimes: Number
})

const data = ref({})

onMounted(() => {
  data.value = {...props}
})

function submitToTheThirdLevelDoctor(next) {
  saveTheThirdLevelDoctor(data.value).then(() => {
    next(data.value)
  })
}

</script>

<style scoped>

</style>
