Pacs.vue 17 KB

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