ExportDclExcel.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <div>请选择要导出的数据:</div>
  3. <div class="input_area">
  4. <el-select v-model="exportRequest.type" style="width: 220px">
  5. <el-option label="复印" value="DUPLICATE"></el-option>
  6. <el-option label="封存" value="CLOSEDOWN"></el-option>
  7. <el-option label="借阅" value="LENDOUT"></el-option>
  8. </el-select>
  9. </div>
  10. <div style="margin-top: 24px">请选择数据时间范围:</div>
  11. <div class="input_area mg-btm">
  12. <CyDateRange />
  13. </div>
  14. </template>
  15. <script setup lang="ts">
  16. import useDateRange from "@/utils/cy-use/useDateRange";
  17. import { Export } from "@/utils/ExportExcel";
  18. import { getExportableDclData } from "@/api/case-front-sheet";
  19. import { UseDialogType } from "@/components/cy/CyDialog/index.js";
  20. const exportRequest = reactive({
  21. type: "DUPLICATE",
  22. begin: "",
  23. end: "",
  24. });
  25. const { CyDateRange, dateRange } = useDateRange({
  26. shortcutsIndex: 5,
  27. clearable: false,
  28. });
  29. function executeExport() {
  30. exportRequest.begin = dateRange.value.start;
  31. exportRequest.end = dateRange.value.end;
  32. let label = getLabel();
  33. getExportableDclData(exportRequest).then(res => {
  34. Export(res, generateField(label), label + "记录");
  35. });
  36. }
  37. function generateField(label) {
  38. const field = {
  39. bah: "住院号",
  40. times: "住院次数",
  41. patName: "患者姓名",
  42. admissDate: "入院时间",
  43. disDate: "出院时间",
  44. disDept: "出院科室",
  45. doctor: "管床医生",
  46. visitStaff: label + "人员",
  47. opTime: label + "时间",
  48. remark: "备注",
  49. opStaff: "病案管理员",
  50. };
  51. if (exportRequest.type === "LENDOUT") {
  52. field.lendStaffPhone = "借阅人员电话";
  53. field.state = "状态";
  54. field.returnTime = "归还时间";
  55. }
  56. return field;
  57. }
  58. function getLabel() {
  59. switch (exportRequest.type) {
  60. case "DUPLICATE":
  61. return "复印";
  62. case "CLOSEDOWN":
  63. return "封存";
  64. case "LENDOUT":
  65. return "借阅";
  66. default:
  67. return "";
  68. }
  69. }
  70. defineExpose<UseDialogType.Expose>({
  71. confirm: executeExport,
  72. });
  73. </script>
  74. <style scoped>
  75. .input_area {
  76. padding: 8px 24px 0 24px;
  77. }
  78. .mg-btm {
  79. margin-bottom: 16px;
  80. }
  81. </style>