Pacs.vue 16 KB

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