Pacs.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  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. let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
  152. if (extend != 'xls' && extend != 'xlsx') {
  153. this.$message({ message: '请根据模板进行导入', type: 'error' });
  154. return;
  155. }
  156. e.preventDefault();
  157. let formData = new FormData();
  158. formData.append('file', fileInfo);
  159. formData.append('type', 3);
  160. const header = {
  161. headers: {
  162. 'Content-Type': 'multipart/form-data'
  163. }
  164. };
  165. const loading = this.$loading({
  166. lock: true,
  167. text: '预匹配中...',
  168. spinner: 'el-icon-loading',
  169. background: 'rgba(0, 0, 0, 0.7)'
  170. });
  171. api.dataDiseaseVerify(formData, header).then(res => {
  172. if (res.data.code === '00020007' || res.data.code === '00020004') {
  173. loading.close();
  174. this.$alert(`${res.data.msg}`, '提示', {
  175. confirmButtonText: '确定',
  176. type: 'warning'
  177. })
  178. .then(() => {})
  179. .catch(() => {});
  180. } else {
  181. api.precDiseaseDataMatch(formData, header).then(res => {
  182. setTimeout(() => {
  183. loading.close();
  184. }, 800);
  185. if (res.status === 200) {
  186. utils.downloadExportedData(
  187. res.data,
  188. '检查关联数据(预匹配).xls'
  189. );
  190. }
  191. });
  192. }
  193. });
  194. let inp = document.getElementById('upFileMatch');
  195. inp.value = '';
  196. },
  197. handleSizeChange(val) {
  198. this.pageSize = val;
  199. this.currentPage = utils.getCurrentPage(
  200. this.currentPage,
  201. this.total,
  202. this.pageSize
  203. );
  204. this.getDataList();
  205. },
  206. // 获取列表数据
  207. getDataList(isTurnPage) {
  208. const params = this.getFilterItems(isTurnPage);
  209. this.searched = true;
  210. const loading = this.$loading({
  211. lock: true,
  212. text: 'Loading',
  213. spinner: 'el-icon-loading',
  214. background: 'rgba(0, 0, 0, 0.7)'
  215. });
  216. api.getpacsPage(params).then(res => {
  217. loading.close();
  218. if (res.data.code === '0') {
  219. this.list = res.data.data && res.data.data.records;
  220. }
  221. this.total = res.data.data && res.data.data.total;
  222. if (this.inCurrentPage !== undefined) {
  223. this.currentPage = this.inCurrentPage;
  224. this.inCurrentPage = undefined;
  225. }
  226. });
  227. },
  228. // 处理列表请求数据参数
  229. getFilterItems(isTurnPage) {
  230. //翻页时筛选条件没点确定则清空
  231. if (isTurnPage && !this.searched) {
  232. this.clearFilter();
  233. }
  234. const param = {
  235. current: this.inCurrentPage || this.currentPage,
  236. size: this.pageSize,
  237. hisName: this.filter.hisName.trim(),
  238. uniqueName: this.filter.uniqueName.trim(),
  239. uniqueCode: '',
  240. type: 3,
  241. isMatch: this.filter.match
  242. };
  243. return param;
  244. },
  245. filterDatas() {
  246. this.currentPage = 1;
  247. this.getDataList();
  248. },
  249. addRelation() {
  250. const pam = this.searched
  251. ? {
  252. currentPage: this.currentPage,
  253. pageSize: this.pageSize,
  254. filter: this.filter
  255. }
  256. : { currentPage: this.currentPage, pageSize: this.pageSize };
  257. this.data = {};
  258. this.showModal();
  259. // this.$router.push({ name: 'AddPacs', params: pam });
  260. },
  261. // 修改诊断关联-跳转至编辑页面
  262. modifyRelation(row) {
  263. const item = Object.assign({}, row);
  264. const pam = this.searched
  265. ? {
  266. currentPage: this.currentPage,
  267. pageSize: this.pageSize,
  268. filter: this.filter
  269. }
  270. : { currentPage: this.currentPage, pageSize: this.pageSize };
  271. this.data = item;
  272. this.showModal();
  273. // this.$router.push({
  274. // name: 'AddPacs',
  275. // params: Object.assign(pam, { isEdit: true, data: item })
  276. // });
  277. },
  278. currentChange(next) {
  279. this.currentPage = next;
  280. this.getDataList(true);
  281. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  282. // this.list = this.cacheData[next];
  283. // } else {
  284. // this.getDataList();
  285. // }
  286. },
  287. // 清空搜索参数
  288. clearFilter() {
  289. this.filter = {
  290. hisName: '',
  291. uniqueName: ''
  292. };
  293. },
  294. indexMethod(index) {
  295. return (this.currentPage - 1) * this.pageSize + index + 1;
  296. },
  297. getTagType(val) {
  298. return val;
  299. },
  300. warning(msg, type) {
  301. this.$message({
  302. showClose: true,
  303. message: msg,
  304. type: type || 'warning'
  305. });
  306. },
  307. showConfirmDialog(msg, resolve) {
  308. this.$confirm(msg, '提示', {
  309. confirmButtonText: '删除',
  310. cancelButtonText: '取消',
  311. cancelButtonClass: 'cancelBtn',
  312. confirmButtonClass: 'confirmC',
  313. type: 'warning'
  314. })
  315. .then(() => {
  316. resolve();
  317. })
  318. .catch(() => {});
  319. },
  320. // 删除关联
  321. showDelDialog(id) {
  322. this.showConfirmDialog('是否删除该关联?', () => {
  323. api
  324. .deletePacsRecord({ id: id })
  325. .then(res => {
  326. if (res.data.code == '0') {
  327. if (!this.searched) {
  328. //未点确认时清空搜索条件
  329. this.clearFilter();
  330. }
  331. if (this.list.length == 1) {
  332. //当前在最后一页且只有一条数据时,删除后跳到前一页
  333. this.currentPage =
  334. this.currentPage === 1 ? 1 : this.currentPage - 1;
  335. }
  336. this.getDataList();
  337. this.warning(res.data.msg || '操作成功', 'success');
  338. } else {
  339. this.warning(res.data.msg);
  340. }
  341. })
  342. .catch(error => {
  343. if (error.code === '900010001') {
  344. return false;
  345. }
  346. this.warning(error);
  347. });
  348. });
  349. },
  350. // 导出数据
  351. exportData() {
  352. this.$confirm('确定要导出全部检查关联数据吗?', '', {
  353. confirmButtonText: '确定',
  354. cancelButtonText: '取消',
  355. cancelButtonClass: 'leftbtn',
  356. customClass: 'exportBox6',
  357. title: '提示',
  358. type: 'warning'
  359. // beforeClose: (action, instance, done) => {
  360. // if (action === 'confirm') {
  361. // // instance.confirmButtonLoading = true;
  362. // instance.confirmButtonText = '导出中...';
  363. // api.exportPacsRecord().then(res => {
  364. // if (res.status === 200) {
  365. // setTimeout(() => {
  366. // utils.downloadExportedData(res.data, '检查关联数据.xls');
  367. // done();
  368. // }, 1500);
  369. // }
  370. // });
  371. // } else {
  372. // done();
  373. // }
  374. // }
  375. })
  376. .then(() => {
  377. api
  378. .exportPacsRecord({ type: 3, isMatch: this.filter.match })
  379. .then(res => {
  380. if (res.status === 200) {
  381. this.$message({ message: '导出成功', type: 'success' });
  382. utils.downloadExportedData(res.data, '检查关联数据.xls');
  383. }
  384. });
  385. })
  386. .catch(() => {
  387. // this.$message({ message: '导出失败', type: 'waring' });
  388. });
  389. },
  390. // 导入模板
  391. exportModule() {
  392. api.exportPacsModule({ type: 3 }).then(res => {
  393. if (res.status === 200) {
  394. setTimeout(() => {
  395. utils.downloadExportedData(res.data, '检查导入模板.xls');
  396. }, 1500);
  397. }
  398. });
  399. },
  400. // 点击导入
  401. importPage() {
  402. let inp = document.getElementById('upFile');
  403. inp.click();
  404. },
  405. // 导入数据
  406. uploadFile(e) {
  407. let fileInfo = e.target.files[0];
  408. let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
  409. if (extend != 'xls' && extend != 'xlsx') {
  410. this.$message({ message: '请根据模板进行导入', type: 'error' });
  411. return;
  412. }
  413. e.preventDefault();
  414. let formData = new FormData();
  415. formData.append('file', fileInfo);
  416. formData.append('type', 3);
  417. formData.append('uesrId', localStorage.getItem('uesrId'));
  418. formData.append(
  419. 'hospitalId',
  420. JSON.parse(localStorage.getItem('hospitalLoginDTO')).id
  421. );
  422. const header = {
  423. headers: {
  424. 'Content-Type': 'multipart/form-data'
  425. }
  426. };
  427. this.uploadInfo = '导入中...';
  428. api.importExcelDataVerify(formData, header).then(res => {
  429. if (res.data.code === '00020001') {
  430. this.$confirm(`${res.data.msg}`, '提示', {
  431. confirmButtonText: '确定',
  432. cancelButtonText: '取消',
  433. type: 'warning'
  434. })
  435. .then(() => {
  436. this.importPacsRecord(formData, header);
  437. })
  438. .catch(() => {
  439. setTimeout(() => {
  440. this.uploadInfo = '导入';
  441. }, 300);
  442. });
  443. } else if (res.data.data === true) {
  444. this.importPacsRecord(formData, header);
  445. }else {
  446. this.$alert(`${res.data.msg}`, '提示', {
  447. confirmButtonText: '确定',
  448. // cancelButtonText: '取消',
  449. // cancelButtonClass: 'cancelSure',
  450. // confirmButtonClass: 'sure',
  451. // customClass: 'exportConfirm',
  452. type: 'warning'
  453. })
  454. .then(() => {})
  455. .catch(() => {});
  456. setTimeout(() => {
  457. this.uploadInfo = '导入';
  458. }, 300);
  459. }
  460. });
  461. //解决上传相同文件不触发change
  462. let inp = document.getElementById('upFile');
  463. inp.value = '';
  464. },
  465. importPacsRecord(formData, header) {
  466. api.importPacsRecord(formData, header).then(res => {
  467. // code === '00000001' 导入失败统一提示 医院术语字符数超出最大数量,请修改后再试
  468. if (res.data.code === '00000001') {
  469. this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
  470. confirmButtonText: '确定',
  471. // cancelButtonText: '取消',
  472. cancelButtonClass: 'cancelSure',
  473. confirmButtonClass: 'sure',
  474. customClass: 'exportConfirm',
  475. type: 'warning'
  476. })
  477. .then(() => {})
  478. .catch(() => {});
  479. this.getDataList(); // 重新获取列表
  480. setTimeout(() => {
  481. this.uploadInfo = '导入';
  482. }, 300);
  483. } else if (res.data.data === true && res.status === 200) {
  484. this.$confirm(`导入成功`, '提示', {
  485. confirmButtonText: '确定',
  486. // cancelButtonText: '取消',
  487. cancelButtonClass: 'cancelSure',
  488. confirmButtonClass: 'sure',
  489. customClass: 'exportConfirm',
  490. type: 'success'
  491. })
  492. .then(() => {})
  493. .catch(() => {});
  494. this.getDataList(); // 重新获取列表
  495. setTimeout(() => {
  496. this.uploadInfo = '导入';
  497. }, 300);
  498. } else {
  499. this.$confirm(`${res.data.msg}`, '提示', {
  500. confirmButtonText: '确定',
  501. // cancelButtonText: '取消',
  502. cancelButtonClass: 'cancelSure',
  503. confirmButtonClass: 'sure',
  504. customClass: 'exportConfirm',
  505. type: 'warning'
  506. })
  507. .then(() => {})
  508. .catch(() => {});
  509. setTimeout(() => {
  510. this.uploadInfo = '导入';
  511. }, 300);
  512. }
  513. });
  514. },
  515. /********新增编辑弹窗**********/
  516. showModal() {
  517. this.modalVisiable = true;
  518. },
  519. getMsgFormSon(data) {
  520. if (data == 'close') {
  521. this.modalVisiable = false;
  522. } else {
  523. this.modalVisiable = false;
  524. this.getDataList();
  525. }
  526. }
  527. }
  528. };
  529. </script>
  530. <style lang="less" scoped>
  531. @import '../../../less/admin.less';
  532. /deep/ .container.knowledgeTitle {
  533. height: 80px;
  534. }
  535. /deep/ .contents.knowledgeContents {
  536. padding: 104px 20px 0;
  537. }
  538. /deep/ .secLine.el-form {
  539. float: right;
  540. display: block;
  541. position: relative;
  542. top: -5px;
  543. }
  544. .delete {
  545. color: red;
  546. }
  547. .delete:hover {
  548. color: red;
  549. }
  550. .pagination {
  551. min-width: 1010px;
  552. }
  553. .downTemplate {
  554. margin-right: 8px;
  555. span {
  556. color: #02a7f0;
  557. }
  558. }
  559. #upFile {
  560. display: none !important;
  561. }
  562. .el-message-box {
  563. /deep/.cancelBtn {
  564. background-color: #d7d7d7;
  565. border-color: transparent;
  566. }
  567. /deep/.confirmC {
  568. background-color: #ff545b !important;
  569. border-color: transparent !important;
  570. }
  571. }
  572. .exportBox6 {
  573. /deep/ .el-message-box__btns {
  574. margin-top: 20px;
  575. }
  576. /deep/ .el-message-box__message {
  577. // text-align: center;
  578. }
  579. /deep/.leftbtn {
  580. background-color: #d7d7d7;
  581. border-color: transparent !important;
  582. }
  583. /deep/ .el-message-box__header {
  584. border-bottom: 1px solid #dcdfe6;
  585. }
  586. }
  587. #upFileMatch {
  588. display: none;
  589. }
  590. </style>