Pacs.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. <template>
  2. <div>
  3. <crumbs title="检查关联维护" style="min-width: 980px" class="knowledgeTitle">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item class="selectMedicine" label="标准术语状态:">
  6. <el-select size="mini" v-model="filter.status" placeholder="请选择" clearable>
  7. <el-option
  8. v-for="item in statusList"
  9. :label="item.name"
  10. :value="item.id"
  11. :key="item.id"
  12. ></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="匹配状态:" class="selectMedicine">
  16. <el-select size="mini" v-model="filter.match" placeholder="请选择" clearable>
  17. <el-option v-for="item in matchList" :label="item.name" :value="item.id" :key="item.id"></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="医院检查项目:">
  21. <el-input size="mini" v-model="filter.hisName" placeholder="请输入" clearable></el-input>
  22. </el-form-item>
  23. <el-form-item label="标准检查项目:">
  24. <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-button size="mini" @click="filterDatas">检索</el-button>
  28. </el-form-item>
  29. </el-form>
  30. <el-form class="secLine" :inline="true">
  31. <el-form-item>
  32. <el-button type="text" class="downTemplate" @click="exportModule">导入模板下载</el-button>
  33. <input type="file" name="uploadfile " id="upFile" @change="uploadFile($event)" />
  34. <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
  35. <el-button size="mini" @click="handleMatchData">预匹配</el-button>
  36. <el-button size="mini" @click="importPage" style="margin:0 10px">{{uploadInfo}}</el-button>
  37. <input type="file" name="uploadfile " id="upFileMatch" @change="uploadFileMatch($event)" />
  38. <el-button size="mini" @click="exportData">导出</el-button>
  39. </el-form-item>
  40. <el-form-item>
  41. <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
  42. </el-form-item>
  43. </el-form>
  44. </crumbs>
  45. <div class="contents knowledgeContents">
  46. <el-table :data="list" border style="width: 100%">
  47. <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="80"></el-table-column>
  48. <el-table-column :resizable="false" prop="gmtModified" label="操作时间" width="180"></el-table-column>
  49. <el-table-column :resizable="false" prop="hisName" label="医院检查项目" show-overflow-tooltip></el-table-column>
  50. <el-table-column :resizable="false" prop="uniqueName" label="标准检查项目" show-overflow-tooltip></el-table-column>
  51. <el-table-column :resizable="false" prop="operate" label="状态">
  52. <template slot-scope="scope">
  53. <span>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column :resizable="false" prop="operate" label="操作">
  57. <template slot-scope="scope">
  58. <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
  59. <span style="margin:0 3px;">|</span>
  60. <el-button
  61. @click="showDelDialog(scope.row.id)"
  62. class="delete"
  63. type="text"
  64. size="small"
  65. >删除</el-button>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <div class="pagination pagepage">
  70. <el-pagination
  71. :current-page.sync="currentPage"
  72. @current-change="currentChange"
  73. background
  74. :page-size="pageSize"
  75. :page-sizes="pageSizeArr"
  76. @size-change="handleSizeChange"
  77. :layout="pageLayout"
  78. :total="total"
  79. ></el-pagination>
  80. </div>
  81. </div>
  82. <LtModal
  83. v-if="modalVisiable"
  84. @func="getMsgFormSon"
  85. :meal="'检查项目'"
  86. :standard="'检查项目'"
  87. :tip="'检查关联'"
  88. :type="3"
  89. :data="data"
  90. ></LtModal>
  91. </div>
  92. </template>
  93. <script>
  94. import api from '@api/icss.js';
  95. import config from '@api/config.js';
  96. import utils from '@api/utils.js';
  97. import LtModal from '@components/common/LtModal';
  98. export default {
  99. name: 'Pacs', //化验大小项和公表维护
  100. data: function() {
  101. return {
  102. list: [],
  103. matchList: [
  104. { id: '', name: '全部' },
  105. { id: 1, name: '已匹配' },
  106. { id: 0, name: '未匹配' },
  107. { id: 2, name: '多项匹配' }
  108. ],
  109. statusList: [
  110. { id: '', name: '全部' },
  111. { id: 1, name: '启用' },
  112. { id: 0, name: '禁用' },
  113. ],
  114. searched: false,
  115. filter: {
  116. hisName: '', // 医院诊断名称
  117. uniqueName: '', //标准诊断名称
  118. match: '',
  119. status:''
  120. },
  121. currentPage: 1,
  122. pageSize: config.pageSize,
  123. pageSizeArr: config.pageSizeArr,
  124. pageLayout: config.pageLayout,
  125. total: 0,
  126. uploadInfo: '导入',
  127. modalVisiable: false,
  128. data: {}
  129. };
  130. },
  131. components: {
  132. LtModal
  133. },
  134. created() {
  135. const that = this;
  136. //返回时避免参数未赋值就获取列表
  137. setTimeout(function() {
  138. that.clearFilter();
  139. that.getDataList();
  140. });
  141. // 非首页 编辑页返回 设置 this.currentPage
  142. if (Object.keys(this.$route.params).length !== 0) {
  143. this.currentPage = this.$route.params.currentPage;
  144. }
  145. },
  146. watch: {
  147. filter: {
  148. handler: function() {
  149. this.searched = false;
  150. },
  151. deep: true
  152. }
  153. },
  154. beforeRouteEnter(to, from, next) {
  155. next(vm => {
  156. //const pm = to.param;
  157. Object.assign(vm, to.params);
  158. vm.inCurrentPage = to.params.currentPage;
  159. });
  160. },
  161. methods: {
  162. // 预匹配
  163. handleMatchData() {
  164. let inp = document.getElementById('upFileMatch');
  165. inp.click();
  166. },
  167. // 导入数据
  168. uploadFileMatch(e) {
  169. let fileInfo = e.target.files[0];
  170. let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
  171. if (extend != 'xls' && extend != 'xlsx') {
  172. this.$message({ message: '请根据模板进行导入', type: 'error' });
  173. return;
  174. }
  175. e.preventDefault();
  176. let formData = new FormData();
  177. formData.append('file', fileInfo);
  178. formData.append('type', 3);
  179. const header = {
  180. headers: {
  181. 'Content-Type': 'multipart/form-data'
  182. }
  183. };
  184. const loading = this.$loading({
  185. lock: true,
  186. text: '预匹配中...',
  187. spinner: 'el-icon-loading',
  188. background: 'rgba(0, 0, 0, 0.7)'
  189. });
  190. api.dataDiseaseVerify(formData, header).then(res => {
  191. if (res.data.code === '00020007' || res.data.code === '00020004') {
  192. loading.close();
  193. this.$alert(`${res.data.msg}`, '提示', {
  194. confirmButtonText: '确定',
  195. type: 'warning'
  196. })
  197. .then(() => {})
  198. .catch(() => {});
  199. } else {
  200. api.precDiseaseDataMatch(formData, header).then(res => {
  201. setTimeout(() => {
  202. loading.close();
  203. }, 800);
  204. if (res.status === 200) {
  205. utils.downloadExportedData(
  206. res.data,
  207. '检查关联数据(预匹配).xls'
  208. );
  209. }
  210. });
  211. }
  212. });
  213. let inp = document.getElementById('upFileMatch');
  214. inp.value = '';
  215. },
  216. handleSizeChange(val) {
  217. this.pageSize = val;
  218. this.currentPage = utils.getCurrentPage(
  219. this.currentPage,
  220. this.total,
  221. this.pageSize
  222. );
  223. this.getDataList();
  224. },
  225. // 获取列表数据
  226. getDataList(isTurnPage) {
  227. const params = this.getFilterItems(isTurnPage);
  228. this.searched = true;
  229. const loading = this.$loading({
  230. lock: true,
  231. text: 'Loading',
  232. spinner: 'el-icon-loading',
  233. background: 'rgba(0, 0, 0, 0.7)'
  234. });
  235. api.getpacsPage(params).then(res => {
  236. loading.close();
  237. if (res.data.code === '0') {
  238. this.list = res.data.data && res.data.data.records;
  239. }
  240. this.total = res.data.data && res.data.data.total;
  241. if (this.inCurrentPage !== undefined) {
  242. this.currentPage = this.inCurrentPage;
  243. this.inCurrentPage = undefined;
  244. }
  245. });
  246. },
  247. // 处理列表请求数据参数
  248. getFilterItems(isTurnPage) {
  249. //翻页时筛选条件没点确定则清空
  250. if (isTurnPage && !this.searched) {
  251. this.clearFilter();
  252. }
  253. const param = {
  254. current: this.inCurrentPage || this.currentPage,
  255. size: this.pageSize,
  256. hisName: this.filter.hisName.trim(),
  257. uniqueName: this.filter.uniqueName.trim(),
  258. uniqueCode: '',
  259. type: 3,
  260. isMatch: this.filter.match,
  261. status:this.filter.status
  262. };
  263. return param;
  264. },
  265. filterDatas() {
  266. this.currentPage = 1;
  267. this.getDataList();
  268. },
  269. addRelation() {
  270. const pam = this.searched
  271. ? {
  272. currentPage: this.currentPage,
  273. pageSize: this.pageSize,
  274. filter: this.filter
  275. }
  276. : { currentPage: this.currentPage, pageSize: this.pageSize };
  277. this.data = {};
  278. this.showModal();
  279. // this.$router.push({ name: 'AddPacs', params: pam });
  280. },
  281. // 修改诊断关联-跳转至编辑页面
  282. modifyRelation(row) {
  283. const item = Object.assign({}, row);
  284. const pam = this.searched
  285. ? {
  286. currentPage: this.currentPage,
  287. pageSize: this.pageSize,
  288. filter: this.filter
  289. }
  290. : { currentPage: this.currentPage, pageSize: this.pageSize };
  291. this.data = item;
  292. this.showModal();
  293. // this.$router.push({
  294. // name: 'AddPacs',
  295. // params: Object.assign(pam, { isEdit: true, data: item })
  296. // });
  297. },
  298. currentChange(next) {
  299. this.currentPage = next;
  300. this.getDataList(true);
  301. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  302. // this.list = this.cacheData[next];
  303. // } else {
  304. // this.getDataList();
  305. // }
  306. },
  307. // 清空搜索参数
  308. clearFilter() {
  309. this.filter = {
  310. hisName: '',
  311. uniqueName: ''
  312. };
  313. },
  314. indexMethod(index) {
  315. return (this.currentPage - 1) * this.pageSize + index + 1;
  316. },
  317. getTagType(val) {
  318. return val;
  319. },
  320. warning(msg, type) {
  321. this.$message({
  322. showClose: true,
  323. message: msg,
  324. type: type || 'warning'
  325. });
  326. },
  327. showConfirmDialog(msg, resolve) {
  328. this.$confirm(msg, '提示', {
  329. confirmButtonText: '删除',
  330. cancelButtonText: '取消',
  331. cancelButtonClass: 'cancelBtn',
  332. confirmButtonClass: 'confirmC',
  333. type: 'warning'
  334. })
  335. .then(() => {
  336. resolve();
  337. })
  338. .catch(() => {});
  339. },
  340. // 删除关联
  341. showDelDialog(id) {
  342. this.showConfirmDialog('是否删除该关联?', () => {
  343. api
  344. .deletePacsRecord({ id: id })
  345. .then(res => {
  346. if (res.data.code == '0') {
  347. if (!this.searched) {
  348. //未点确认时清空搜索条件
  349. this.clearFilter();
  350. }
  351. if (this.list.length == 1) {
  352. //当前在最后一页且只有一条数据时,删除后跳到前一页
  353. this.currentPage =
  354. this.currentPage === 1 ? 1 : this.currentPage - 1;
  355. }
  356. this.getDataList();
  357. this.warning(res.data.msg || '操作成功', 'success');
  358. } else {
  359. this.warning(res.data.msg);
  360. }
  361. })
  362. .catch(error => {
  363. if (error.code === '900010001') {
  364. return false;
  365. }
  366. this.warning(error);
  367. });
  368. });
  369. },
  370. // 导出数据
  371. exportData() {
  372. this.$confirm('确定要导出全部检查关联数据吗?', '', {
  373. confirmButtonText: '确定',
  374. cancelButtonText: '取消',
  375. cancelButtonClass: 'leftbtn',
  376. customClass: 'exportBox6',
  377. title: '提示',
  378. type: 'warning'
  379. // beforeClose: (action, instance, done) => {
  380. // if (action === 'confirm') {
  381. // // instance.confirmButtonLoading = true;
  382. // instance.confirmButtonText = '导出中...';
  383. // api.exportPacsRecord().then(res => {
  384. // if (res.status === 200) {
  385. // setTimeout(() => {
  386. // utils.downloadExportedData(res.data, '检查关联数据.xls');
  387. // done();
  388. // }, 1500);
  389. // }
  390. // });
  391. // } else {
  392. // done();
  393. // }
  394. // }
  395. })
  396. .then(() => {
  397. api
  398. .exportPacsRecord({ type: 3, isMatch: this.filter.match })
  399. .then(res => {
  400. if (res.status === 200) {
  401. this.$message({ message: '导出成功', type: 'success' });
  402. utils.downloadExportedData(res.data, '检查关联数据.xls');
  403. }
  404. });
  405. })
  406. .catch(() => {
  407. // this.$message({ message: '导出失败', type: 'waring' });
  408. });
  409. },
  410. // 导入模板
  411. exportModule() {
  412. api.exportPacsModule({ type: 3 }).then(res => {
  413. if (res.status === 200) {
  414. setTimeout(() => {
  415. utils.downloadExportedData(res.data, '检查导入模板.xls');
  416. }, 1500);
  417. }
  418. });
  419. },
  420. // 点击导入
  421. importPage() {
  422. let inp = document.getElementById('upFile');
  423. inp.click();
  424. },
  425. // 导入数据
  426. uploadFile(e) {
  427. let fileInfo = e.target.files[0];
  428. let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
  429. if (extend != 'xls' && extend != 'xlsx') {
  430. this.$message({ message: '请根据模板进行导入', type: 'error' });
  431. return;
  432. }
  433. e.preventDefault();
  434. let formData = new FormData();
  435. formData.append('file', fileInfo);
  436. formData.append('type', 3);
  437. formData.append('uesrId', localStorage.getItem('uesrId'));
  438. formData.append(
  439. 'hospitalId',
  440. JSON.parse(localStorage.getItem('hospitalLoginDTO')).id
  441. );
  442. const header = {
  443. headers: {
  444. 'Content-Type': 'multipart/form-data'
  445. }
  446. };
  447. this.importPacsRecord(formData, header);
  448. // this.uploadInfo = '导入中...';
  449. // api.importExcelDataVerify(formData, header).then(res => {
  450. // if (res.data.code === '00020001') {
  451. // this.$confirm(`${res.data.msg}`, '提示', {
  452. // confirmButtonText: '确定',
  453. // cancelButtonText: '取消',
  454. // type: 'warning'
  455. // })
  456. // .then(() => {
  457. // this.importPacsRecord(formData, header);
  458. // })
  459. // .catch(() => {
  460. // setTimeout(() => {
  461. // this.uploadInfo = '导入';
  462. // }, 300);
  463. // });
  464. // } else if (res.data.data === true) {
  465. // this.importPacsRecord(formData, header);
  466. // }else {
  467. // this.$alert(`${res.data.msg}`, '提示', {
  468. // confirmButtonText: '确定',
  469. // // cancelButtonText: '取消',
  470. // // cancelButtonClass: 'cancelSure',
  471. // // confirmButtonClass: 'sure',
  472. // // customClass: 'exportConfirm',
  473. // type: 'warning'
  474. // })
  475. // .then(() => {})
  476. // .catch(() => {});
  477. // setTimeout(() => {
  478. // this.uploadInfo = '导入';
  479. // }, 300);
  480. // }
  481. // });
  482. //解决上传相同文件不触发change
  483. let inp = document.getElementById('upFile');
  484. inp.value = '';
  485. },
  486. importPacsRecord(formData, header) {
  487. api.importPacsRecord(formData, header).then(res => {
  488. if (res.headers['content-disposition']) {
  489. this.downloadUrl(res);
  490. } else {
  491. this.$alert(`导入成功`, '提示', {
  492. confirmButtonText: '确定',
  493. // cancelButtonText: '取消',
  494. // cancelButtonClass: 'cancelSure',
  495. // confirmButtonClass: 'sure',
  496. // customClass: 'exportConfirm',
  497. type: 'success'
  498. });
  499. }
  500. // if (res.data.code === '00000001') {
  501. // this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
  502. // confirmButtonText: '确定',
  503. // // cancelButtonText: '取消',
  504. // cancelButtonClass: 'cancelSure',
  505. // confirmButtonClass: 'sure',
  506. // customClass: 'exportConfirm',
  507. // type: 'warning'
  508. // })
  509. // .then(() => {})
  510. // .catch(() => {});
  511. // this.getDataList(); // 重新获取列表
  512. // setTimeout(() => {
  513. // this.uploadInfo = '导入';
  514. // }, 300);
  515. // } else if (res.data.data === true && res.status === 200) {
  516. // this.$confirm(`导入成功`, '提示', {
  517. // confirmButtonText: '确定',
  518. // // cancelButtonText: '取消',
  519. // cancelButtonClass: 'cancelSure',
  520. // confirmButtonClass: 'sure',
  521. // customClass: 'exportConfirm',
  522. // type: 'success'
  523. // })
  524. // .then(() => {})
  525. // .catch(() => {});
  526. // this.getDataList(); // 重新获取列表
  527. // setTimeout(() => {
  528. // this.uploadInfo = '导入';
  529. // }, 300);
  530. // } else {
  531. // this.$confirm(`${res.data.msg}`, '提示', {
  532. // confirmButtonText: '确定',
  533. // // cancelButtonText: '取消',
  534. // cancelButtonClass: 'cancelSure',
  535. // confirmButtonClass: 'sure',
  536. // customClass: 'exportConfirm',
  537. // type: 'warning'
  538. // })
  539. // .then(() => {})
  540. // .catch(() => {});
  541. // setTimeout(() => {
  542. // this.uploadInfo = '导入';
  543. // }, 300);
  544. // }
  545. });
  546. },
  547. downloadUrl(res) {
  548. var disposition = res.headers['content-disposition'];
  549. var fileName = decodeURI(
  550. disposition.split('filename=')[1].split(';filename*=')[0]
  551. );
  552. let blob = new Blob([res.data], { type: 'application/.xls' }); //.xls是我和后台约定好的文件格式
  553. let link = document.createElement('a');
  554. link.href = window.URL.createObjectURL(blob);
  555. link.download = fileName;
  556. link.click();
  557. link.remove();
  558. },
  559. /********新增编辑弹窗**********/
  560. showModal() {
  561. this.modalVisiable = true;
  562. },
  563. getMsgFormSon(data) {
  564. if (data == 'close') {
  565. this.modalVisiable = false;
  566. } else {
  567. this.modalVisiable = false;
  568. this.getDataList();
  569. }
  570. }
  571. }
  572. };
  573. </script>
  574. <style lang="less" scoped>
  575. @import '../../../less/admin.less';
  576. /deep/ .container.knowledgeTitle {
  577. height: 80px;
  578. }
  579. /deep/ .contents.knowledgeContents {
  580. padding: 104px 20px 0;
  581. }
  582. /deep/ .secLine.el-form {
  583. float: right;
  584. display: block;
  585. position: relative;
  586. top: -5px;
  587. }
  588. .delete {
  589. color: red;
  590. }
  591. .delete:hover {
  592. color: red;
  593. }
  594. .pagination {
  595. min-width: 1010px;
  596. }
  597. .downTemplate {
  598. margin-right: 8px;
  599. span {
  600. color: #02a7f0;
  601. }
  602. }
  603. #upFile {
  604. display: none !important;
  605. }
  606. .el-message-box {
  607. /deep/.cancelBtn {
  608. background-color: #d7d7d7;
  609. border-color: transparent;
  610. }
  611. /deep/.confirmC {
  612. background-color: #ff545b !important;
  613. border-color: transparent !important;
  614. }
  615. }
  616. .exportBox6 {
  617. /deep/ .el-message-box__btns {
  618. margin-top: 20px;
  619. }
  620. /deep/ .el-message-box__message {
  621. // text-align: center;
  622. }
  623. /deep/.leftbtn {
  624. background-color: #d7d7d7;
  625. border-color: transparent !important;
  626. }
  627. /deep/ .el-message-box__header {
  628. border-bottom: 1px solid #dcdfe6;
  629. }
  630. }
  631. #upFileMatch {
  632. display: none;
  633. }
  634. </style>