ChemicalAndCommonMapping.vue 21 KB

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