Эх сурвалжийг харах

[新增] 住院病历查询-专业检索

zdl 1 жил өмнө
parent
commit
bf8373a455

+ 10 - 0
src/api/excel.js

@@ -77,4 +77,14 @@ export function doctorAdviceExport(data) {
     responseType: 'blob',
     data
   })
+}
+
+// 住院病历查询-导出
+export function professionSearchExport(data) {
+  return request_blob({
+    url: `/bass/bl/serachExport`,
+    method: 'post',
+    responseType: 'blob',
+    data
+  })
 }

+ 62 - 3
src/views/search/components/ProfessionSearch.vue

@@ -140,7 +140,13 @@
             </el-form>
           </div>
         </el-collapse-transition>
-        <el-button type="primary" class="search-btn" @click="onSearch">检 索</el-button>
+        <div class="btn-group">
+          <el-button type="primary" class="search-btn" @click="onSearch">检 索</el-button>
+          <div class="btn-group-right">
+            <el-button type="primary" plain @click="onExport">导出Excel</el-button>
+            <el-button @click="onReset">重置条件</el-button>
+          </div>
+        </div>
       </div>
     </div>
   </div>
@@ -442,6 +448,52 @@ export default {
         ...this.formInline2
       }
       this.$emit('search', params)
+    },
+    // 导出
+    onExport() {
+      const { ageType, ageStart, ageEnd } = this.formInline2
+      if (ageType === 1) {
+        this.formInline2.AAA40_START = ageStart
+        this.formInline2.AAA40_END = ageEnd
+      } else if (ageType === 2) {
+        this.formInline2.AAA04_START = ageStart
+        this.formInline2.AAA04_END = ageEnd
+      }
+      const params = {
+        ...this.formInline,
+        ...this.formInline2
+      }
+      this.$emit('export', params)
+    },
+    // 重置
+    onReset() {
+      this.formInline = {
+        AAA28: '',
+        AAC11N: '',
+        AAC01_START: '',
+        AAC01_END: ''
+      }
+
+      this.formInline2 = {
+        AAA01: '',
+        AAA02C: '',
+        AAB01_START: '',
+        AAB01_END: '',
+        AAC04_START: '',
+        AAC04_END: '',
+        ageStart: '',// 自定义需根据ageType转化相应字段
+        ageEnd: '',// 自定义需根据ageType转化相应字段
+        ageType: 2,
+        TIWEN_START: '',
+        TIWEN_END: '',
+        field: [{
+          select_type: 0,
+          key: '',
+          value: '',
+        }]
+      }
+
+      this.$emit('reset')
     }
   }
 }
@@ -472,8 +524,6 @@ export default {
   }
   .search-btn {
     width: 240px;
-    display: block;
-    margin: 0 auto;
   }
 }
 ::v-deep .el-input-group__append {
@@ -482,4 +532,13 @@ export default {
 ::v-deep .el-form--inline .el-form-item {
   margin-right: 20px;
 }
+.btn-group {
+  text-align: center;
+  position: relative;
+  .btn-group-right {
+    position: absolute;
+    right: 0;
+    top: 0;
+  }
+}
 </style>

+ 29 - 2
src/views/search/index.vue

@@ -165,7 +165,7 @@
         <el-button class="btn2" @click="searchBtn(1)">检索</el-button>
       </div>
       <!-- 专业检索 -->
-      <ProfessionSearchVue v-if="choice == 2" @search="handleProfessionSearch" />
+      <ProfessionSearchVue v-if="choice == 2" @search="handleProfessionSearch" @export="handelExport" @reset="handleReset" />
     </div>
     <div class="tableBox">
       <div class="flextab" style="margin: 0; margin-bottom: 30px; display: block">
@@ -405,7 +405,7 @@
 import Title from '@/components/Title';
 import { mapGetters } from 'vuex';
 import mPagination from '@/components/m-pagination';
-import { bassNormalSearchDownload, bassHighSearchDownload } from '@/api/excel';
+import { bassNormalSearchDownload, bassHighSearchDownload, professionSearchExport } from '@/api/excel';
 import ProfessionSearchVue from './components/ProfessionSearch.vue';
 
 export default {
@@ -763,6 +763,7 @@ export default {
     },
     // 专业检索
     handleProfessionSearch(params) {
+      this.paginationData.currentPage = 1
       this.$axios3.post('/bl/serach', params).then(res => {
         this.tableData = res.data.list || [];
         this.tableDataDetails = res.data.detail || [];
@@ -782,6 +783,32 @@ export default {
       } else {
         return true
       } 
+    },
+    // 导出
+    handelExport(params) {
+      professionSearchExport(params).then(res => {
+        const content = res.data; // 后台返回二进制数据
+        const blob = new Blob([content]);
+        const fileName = `住院病历查询.csv`;
+        if ('download' in document.createElement('a')) {
+          // 非IE下载
+          const elink = document.createElement('a');
+          elink.download = fileName;
+          elink.style.display = 'none';
+          elink.href = URL.createObjectURL(blob);
+          document.body.appendChild(elink);
+          elink.click();
+          URL.revokeObjectURL(elink.href); // 释放URL 对象
+          document.body.removeChild(elink);
+        } else {
+          // IE10+下载
+          navigator.msSaveBlob(blob, fileName);
+        }
+      });
+    },
+    // 重置
+    handleReset() {
+      this.handleProfessionSearch({})
     }
   },
 };