<template>
  <div>
    <el-form label-width="100px" size="small" :model="props.data">
      <el-row>
        <el-col :span="12">
          <el-form-item label="检查项目编码:">
            {{ props.data.orderCode }}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="检查项目名称:">
            {{ props.data.orderName }}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item class="bi_tian" label="检查时间:">
            <el-date-picker
                v-model="props.data.startTime"
                ref="checkTheTimeRef"
                format="YYYY-MM-DD HH:mm:ss"
                style="width: 180px"
                type="datetime"
                value-format="YYYY-MM-DD HH:mm:ss">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item class="bi_tian" label="执行科室:">
            <xc-select-v3
                style="width: 120px"
                v-model="props.data"
                :data="zhiXingKeShiData"
                code="execDept"
                name="execDeptName"
                :remote-method="metZhiXingKeShi"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="急诊:">
            <el-switch
                v-model="props.data.jzFlag"
                :active-value="1"
                :inactive-value="0"
                active-color="#13ce66"
                active-text="急诊"
                inactive-color="#ff4949"
                inactive-text="普通"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="自费:">
            <el-switch
                v-model="props.data.ybSelfFlag"
                :active-value="1"
                :inactive-value="0"
                active-color="#13ce66"
                active-text="急诊"
                inactive-color="#ff4949"
                inactive-text="普通"
            >
            </el-switch>
          </el-form-item>
        </el-col>
        <el-col v-if="jianCha" :span="12">
          <el-form-item class="bi_tian" label="临床诊断:" prop="diagCode">
            <xc-select-v3
                v-model="props.data"
                :data="props.diagnosis"
                :remote-method="searchDiagnostics"
                code="diagCode"
                name="diagText"/>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item v-if="!jianCha" class="bi_tian" label="标本：">
            <el-select v-model="props.data.inspectStuff"
                       :remote-method="specimenSearch" clearable filterable
                       remote @change="bianBenMing">
              <el-option v-for="item in biaoBenShuJu" :key="item.code" :label="item.name" :value="item.code">
                <span style="color: #8492a6; font-size: 12px">{{ item.code }}</span>
                <el-divider direction="vertical"></el-divider>
                <span>{{ item.name }}</span>
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item :label="jianCha ? '病室摘要:' : '申请说明'" class="bi_tian">
            <el-input v-model="props.data.reqComment" :rows="6" maxlength="125" show-word-limit
                      type="textarea"></el-input>
          </el-form-item>
        </el-col>
        <!--        <el-col v-if="jianCha" :span="12">-->
        <!--          <el-button @click="daKaiShuoMingMuBan">说明模板</el-button>-->
        <!--        </el-col>-->
        <el-col v-if="jianCha" :span="24">
          <el-form-item class="bi_tian" label="体征信息:">
            <el-input v-model="props.data.reqTzComment" :rows="6" maxlength="125" show-word-limit
                      type="textarea"></el-input>
          </el-form-item>
        </el-col>
        <el-col v-if="jianCha" :span="24">
          <el-form-item class="bi_tian" label="相关辅检结果:">
            <el-input v-model="props.data.reqOtherResult" :rows="6" maxlength="125" show-word-limit
                      type="textarea"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script setup name='InspectionRequisition'>
// 编辑检验检查
import XcSelectV3 from "@/components/xiao-chan/select-v3/XcSelectV3";
import {ref} from "vue";
import {huoQuZhiXinKeShi} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";

const props = defineProps({
  jianCha: {
    type: Boolean,
    default: true,
  },
  data: Object,
  linChuangZhenDuanShuJu: Array,
  diagnosis: Array,
  // 临床诊断搜索
  searchDiagnostics: {
    type: Function,
    default: (val) => {
      console.log(val)
    }
  },
  // 标本搜索
  specimenSearch: {
    type: Function,
    default: (val) => {
      console.log(val)
    }
  },
})


/* 获取执行科室 */
const zhiXingKeShiData = ref([])
const metZhiXingKeShi = (val) => {
  huoQuZhiXinKeShi(val).then((res) => {
    zhiXingKeShiData.value = res
  })
}

</script>

<style scoped lang="scss">

</style>
