Pacs.vue 21 KB

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