﻿<template>
  <div class="app-container">
    <!-- 添加或修改用户配置对话框 -->
    <el-dialog
      v-model="visible"
      :title="详情"
      width="1200px"
      teleported
    >
      <div style="width: 100%">
        <vxe-table
          max-height="650"
          :data="ePrescribingDetailList"
          border
        >
          <vxe-column
            title="处方号"
            align="center"
            field="prescriptionNo"
            sortable
            width="100"
          />
          <vxe-column
            title="门诊号"
            align="center"
            field="iptOtpNo"
          />
          <vxe-column
            title="患者姓名"
            align="center"
            field="patnName"
          />
          <vxe-column
            title="身份证号"
            align="center"
            field="certno"
          />
          <vxe-column
            title="诊断名"
            align="center"
            field="conditionName"
          />
          <vxe-column
            title="慢性诊断名"
            align="center"
            field="specialConditionName"
            width="180"
          />

          <vxe-column
            title="请求数量"
            align="center"
            field="quantity"
          />
          <vxe-column
            title="请求单位"
            align="center"
            field="unitCode"
          />
          <vxe-column
            title="审核状态"
            align="center"
            field="statusEnum_enumText"
          />
          <vxe-column
            title="药品名"
            align="center"
            field="medicationName"
          />
          <vxe-column
            title="药品规格"
            align="center"
            field="drugSpecification"
          />
          <vxe-column
            title="药品剂量"
            align="center"
            field="medDosage"
          />
          <vxe-column
            title="药品剂量单位"
            align="center"
            field="medDosageUnitCode"
          />
          <vxe-column
            title="使用频次"
            align="center"
            field="medFrequency_dictText"
          />
          <vxe-column
            title="途径"
            align="center"
            field="medRoute_dictText"
          />
          <vxe-column
            title="取药状态"
            align="center"
            field="medStatus"
          />
          <vxe-column
            title="处方状态"
            align="center"
            field="prescriptionStatus"
          />
          <vxe-column
            title="处方类别"
            align="center"
            field="rxTypeCode_enumText"
          />
          <vxe-column
            title="支持用药信息"
            align="center"
            field="supportInfo"
          />
          <vxe-column
            title="服药时间(开始)"
            align="center"
            field="effectiveDoseStart"
          >
            <template #default="scope">
              {{ formatDate(scope.row.effectiveDoseStart) }}
            </template>
          </vxe-column>
          <vxe-column
            title="服药时间(结束)"
            align="center"
            field="effectiveDoseEnd"
          >
            <template #default="scope">
              {{ formatDate(scope.row.effectiveDoseEnd) }}
            </template>
          </vxe-column>
          <vxe-column
            title="给药间隔"
            align="center"
            field="dispenseInterval"
          />
          <vxe-column
            title="单次发药数"
            align="center"
            field="dispensePerQuantity"
          />
          <vxe-column
            title="每次发药供应天数"
            align="center"
            field="dispensePerDuration"
          />

          <vxe-column
            title="开方医生名"
            align="center"
            field="practitionerName"
          />
          <vxe-column
            title="挂号科室"
            align="center"
            field="mdtrtDeptName"
          />
          <vxe-column
            title="开单科室"
            align="center"
            field="prscDeptName"
          />
          <vxe-column
            title="挂号日期"
            align="center"
            field="mdtrtTime"
          >
            <template #default="scope">
              {{ formatDate(scope.row.mdtrtTime) }}
            </template>
          </vxe-column>
          <vxe-column
            title="处方开立日期"
            align="center"
            field="prscTime"
          >
            <template #default="scope">
              {{ formatDate(scope.row.prscTime) }}
            </template>
          </vxe-column>
        </vxe-table>
        <!-- <pagination
          v-show="total > 0"
          :total="total"
          v-model:page="queryParams.pageNo"
          v-model:limit="queryParams.pageSize"
          @pagination="getList"
        /> -->
      </div>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="cancel">
            取 消
          </el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="EPrescribingDetailDialog">
import {formatDate} from '@/utils/index';

const { proxy } = getCurrentInstance();
const { unit_code, yb_type, fin_type_code, activity_category_code, chrgitm_lv } = proxy.useDict(
  'unit_code',
  'yb_type',
  'fin_type_code',
  'activity_category_code',
  'chrgitm_lv'
);

const title = ref('');
const visible = ref(false);
const emits = defineEmits(['submit']); // 声明自定义事件
const ePrescribingDetailList = ref(undefined);

const data = reactive({
  form: {},
  rules: {},
});

const { queryParams, form, rules } = toRefs(data);

const props = defineProps({
  ePrescribingDetail: {
    type: Object,
    required: false,
  },
});

// 显示弹框
function show() {
  reset();
  ePrescribingDetailList.value = props.ePrescribingDetail;
  visible.value = true;
}

/** 重置操作表单 */
function reset() {
  ePrescribingDetailList.value = [];
}

/** 取消按钮 */
function cancel() {
  visible.value = false;
  reset();
}
defineExpose({
  show,
});
</script>
<style scoped>
.el-form--inline .el-form-item {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 10px !important;
}

/* 使用深度选择器 */
.custom-label-spacing :deep(.el-form-item__label) {
  line-height: 1.2; /* 调整行间距 */
  margin-bottom: 4px; /* 调整 label 和输入框之间的间距 */
}
</style>
