Pacs.vue 21 KB

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