Pacs.vue 19 KB

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