ChemicalAndCommonMapping.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  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="code" label="ICD-10编码" show-overflow-tooltip></el-table-column>
  38. <el-table-column :resizable="false" prop="uniqueName" label="标准诊断名称" show-overflow-tooltip></el-table-column>
  39. <el-table-column :resizable="false" prop="operate" label="状态">
  40. <template slot-scope="scope">
  41. <span>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column :resizable="false" prop="operate" label="操作">
  45. <template slot-scope="scope">
  46. <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
  47. <span style="margin:0 3px;">|</span>
  48. <el-button
  49. @click="showDelDialog(scope.row.id)"
  50. class="delete"
  51. type="text"
  52. size="small"
  53. >删除</el-button>
  54. </template>
  55. </el-table-column>
  56. </el-table>
  57. <div class="pagination pagepage">
  58. <el-pagination
  59. :current-page.sync="currentPage"
  60. @current-change="currentChange"
  61. background
  62. :page-size="pageSize"
  63. :page-sizes="pageSizeArr"
  64. @size-change="handleSizeChange"
  65. :layout="pageLayout"
  66. :total="total"
  67. ></el-pagination>
  68. </div>
  69. </div>
  70. <LtModal
  71. v-if="modalVisiable"
  72. @func="getMsgFormSon"
  73. :meal="'诊断名称'"
  74. :standard="'诊断名称'"
  75. :tip="'诊断关联'"
  76. :type="4"
  77. :data="data"
  78. ></LtModal>
  79. </div>
  80. </template>
  81. <script>
  82. import api from '@api/icss.js';
  83. import config from '@api/config.js';
  84. import utils from '@api/utils.js';
  85. import LtModal from '@components/common/LtModal';
  86. export default {
  87. name: 'ChemicalAndCommonMapping', //化验大小项和公表维护
  88. data: function() {
  89. return {
  90. list: [],
  91. matchList: [
  92. { id: '', name: '全部' },
  93. { id: 1, name: '已匹配' },
  94. { id: 0, name: '未匹配' },
  95. { id: 2, name: '多项匹配' }
  96. ],
  97. searched: false,
  98. filter: {
  99. hisName: '', // 医院诊断名称
  100. uniqueName: '', //标准诊断名称
  101. match: ''
  102. },
  103. currentPage: 1,
  104. pageSize: config.pageSize,
  105. pageSizeArr: config.pageSizeArr,
  106. pageLayout: config.pageLayout,
  107. total: 0,
  108. uploadInfo: '导入',
  109. modalVisiable: false,
  110. data: {}
  111. };
  112. },
  113. components: {
  114. LtModal
  115. },
  116. created() {
  117. const param = this.$route.params;
  118. if (param.currentPage) {
  119. this.inCurrentPage = param.currentPage;
  120. }
  121. if (param.filter) {
  122. this.filter = param.filter;
  123. }
  124. //返回时避免参数未赋值就获取列表
  125. setTimeout(() => {
  126. // this.clearFilter();
  127. this.getDataList();
  128. });
  129. },
  130. watch: {
  131. filter: {
  132. handler: function() {
  133. this.searched = false;
  134. },
  135. deep: true
  136. }
  137. },
  138. // beforeRouteEnter(to, from, next) {
  139. // next(vm => {
  140. // //const pm = to.param;
  141. // Object.assign(vm, to.params);
  142. // vm.inCurrentPage = to.params.currentPage;
  143. // });
  144. // },
  145. methods: {
  146. // 预匹配
  147. handleMatchData() {
  148. let inp = document.getElementById('upFileMatch');
  149. inp.click();
  150. },
  151. // 导入数据
  152. uploadFileMatch(e) {
  153. let fileInfo = e.target.files[0];
  154. let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
  155. if (extend != 'xls') {
  156. this.$message({ message: '请根据模板进行导入', type: 'error' });
  157. return;
  158. }
  159. e.preventDefault();
  160. let formData = new FormData();
  161. formData.append('file', fileInfo);
  162. formData.append('type', 4);
  163. const header = {
  164. headers: {
  165. 'Content-Type': 'multipart/form-data'
  166. }
  167. };
  168. const loading = this.$loading({
  169. lock: true,
  170. text: '预匹配中...',
  171. spinner: 'el-icon-loading',
  172. background: 'rgba(0, 0, 0, 0.7)'
  173. });
  174. api.dataDiseaseVerify(formData, header).then(res => {
  175. if (res.data.code === '00020007' || res.data.code === '00020004') {
  176. loading.close();
  177. this.$alert(`${res.data.msg}`, '提示', {
  178. confirmButtonText: '确定',
  179. type: 'warning'
  180. })
  181. .then(() => {})
  182. .catch(() => {});
  183. } else {
  184. api.precDiseaseDataMatch(formData, header).then(res => {
  185. setTimeout(() => {
  186. loading.close();
  187. }, 800);
  188. if (res.status === 200) {
  189. utils.downloadExportedData(
  190. res.data,
  191. '诊断关联数据(预匹配).xls'
  192. );
  193. }
  194. });
  195. }
  196. });
  197. let inp = document.getElementById('upFileMatch');
  198. inp.value = '';
  199. },
  200. handleSizeChange(val) {
  201. this.pageSize = val;
  202. this.currentPage = utils.getCurrentPage(
  203. this.currentPage,
  204. this.total,
  205. this.pageSize
  206. );
  207. this.getDataList();
  208. },
  209. // 获取列表数据
  210. getDataList(isTurnPage) {
  211. const params = this.getFilterItems(isTurnPage);
  212. this.searched = true;
  213. const loading = this.$loading({
  214. lock: true,
  215. text: 'Loading',
  216. spinner: 'el-icon-loading',
  217. background: 'rgba(0, 0, 0, 0.7)'
  218. });
  219. api.getLisMappingPage(params).then(res => {
  220. loading.close();
  221. if (res.data.code === '0') {
  222. this.list = res.data.data && res.data.data.records;
  223. }
  224. this.total = res.data.data && res.data.data.total;
  225. if (this.inCurrentPage !== undefined) {
  226. this.currentPage = this.inCurrentPage;
  227. this.inCurrentPage = undefined;
  228. }
  229. });
  230. },
  231. // 处理列表请求数据参数
  232. getFilterItems(isTurnPage) {
  233. //翻页时筛选条件没点确定则清空
  234. if (isTurnPage && !this.searched) {
  235. this.clearFilter();
  236. }
  237. const param = {
  238. current: this.inCurrentPage || this.currentPage,
  239. size: this.pageSize,
  240. hisName: this.filter.hisName.trim(),
  241. uniqueName: this.filter.uniqueName.trim(),
  242. icdCode: '',
  243. type: 4,
  244. isMatch: this.filter.match
  245. };
  246. return param;
  247. },
  248. filterDatas() {
  249. this.currentPage = 1;
  250. this.getDataList();
  251. },
  252. addRelation() {
  253. const pam = this.searched
  254. ? {
  255. currentPage: this.currentPage,
  256. pageSize: this.pageSize,
  257. filter: this.filter
  258. }
  259. : { currentPage: this.currentPage, pageSize: this.pageSize };
  260. this.data = {};
  261. this.showModal();
  262. // this.$router.push({ name: 'AddChemicalAndCommonMapping', params: pam });
  263. },
  264. // 修改诊断关联-跳转至编辑页面
  265. modifyRelation(row) {
  266. const item = Object.assign({}, row);
  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 = item;
  275. this.showModal();
  276. // this.$router.push({
  277. // name: 'AddChemicalAndCommonMapping',
  278. // params: Object.assign(pam, { isEdit: true, data: item })
  279. // });
  280. },
  281. currentChange(next) {
  282. this.currentPage = next;
  283. this.getDataList(true);
  284. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  285. // this.list = this.cacheData[next];
  286. // } else {
  287. // this.getDataList();
  288. // }
  289. },
  290. // 清空搜索参数
  291. clearFilter() {
  292. this.filter = {
  293. hisName: '',
  294. uniqueName: ''
  295. };
  296. },
  297. indexMethod(index) {
  298. return (this.currentPage - 1) * this.pageSize + index + 1;
  299. },
  300. getTagType(val) {
  301. return val;
  302. },
  303. warning(msg, type) {
  304. this.$message({
  305. showClose: true,
  306. message: msg,
  307. type: type || 'warning'
  308. });
  309. },
  310. showConfirmDialog(msg, resolve) {
  311. this.$confirm(msg, '提示', {
  312. confirmButtonText: '删除',
  313. cancelButtonText: '取消',
  314. cancelButtonClass: 'cancelBtn',
  315. confirmButtonClass: 'confirmC',
  316. type: 'warning'
  317. })
  318. .then(() => {
  319. resolve();
  320. })
  321. .catch(() => {});
  322. },
  323. // 删除关联
  324. showDelDialog(id) {
  325. this.showConfirmDialog('是否删除该关联?', () => {
  326. api
  327. .deleteDiseaseRecord({ id: id })
  328. .then(res => {
  329. if (res.data.code == '0') {
  330. if (!this.searched) {
  331. //未点确认时清空搜索条件
  332. this.clearFilter();
  333. }
  334. if (this.list.length == 1) {
  335. //当前在最后一页且只有一条数据时,删除后跳到前一页
  336. this.currentPage =
  337. this.currentPage === 1 ? 1 : this.currentPage - 1;
  338. }
  339. this.getDataList();
  340. this.warning(res.data.msg || '操作成功', 'success');
  341. } else {
  342. this.warning(res.data.msg);
  343. }
  344. })
  345. .catch(error => {
  346. if (error.code === '900010001') {
  347. return false;
  348. }
  349. this.warning(error);
  350. });
  351. });
  352. },
  353. // 导出数据
  354. exportData() {
  355. this.$confirm('确定要导出全部诊断关联数据吗?', '', {
  356. confirmButtonText: '确定',
  357. cancelButtonText: '取消',
  358. cancelButtonClass: 'leftbtn',
  359. customClass: 'exportBox6',
  360. title: '提示',
  361. type: 'warning'
  362. // beforeClose: (action, instance, done) => {
  363. // if (action === 'confirm') {
  364. // // instance.confirmButtonLoading = true;
  365. // instance.confirmButtonText = '导出中...';
  366. // api.exportDiseaseRecord().then(res => {
  367. // if (res.status === 200) {
  368. // setTimeout(() => {
  369. // utils.downloadExportedData(res.data, '诊断关联数据.xls');
  370. // done();
  371. // }, 1500);
  372. // }
  373. // });
  374. // } else {
  375. // done();
  376. // }
  377. // }
  378. })
  379. .then(() => {
  380. api.exportDiseaseRecord({type:4,isMatch:this.filter.match}).then(res => {
  381. if (res.status === 200) {
  382. this.$message({ message: '导出成功', type: 'success' });
  383. utils.downloadExportedData(res.data, '诊断关联数据.xls');
  384. }
  385. });
  386. })
  387. .catch(() => {
  388. // this.$message({ message: '导出失败', type: 'waring' });
  389. });
  390. },
  391. // 导入模板
  392. exportModule() {
  393. api.exportDiseaseModule({type:4}).then(res => {
  394. if (res.status === 200) {
  395. setTimeout(() => {
  396. utils.downloadExportedData(res.data, '诊断导入模板.xls');
  397. }, 1500);
  398. }
  399. });
  400. },
  401. // 点击导入
  402. importPage() {
  403. let inp = document.getElementById('upFile');
  404. inp.click();
  405. },
  406. // 导入数据
  407. uploadFile(e) {
  408. let fileInfo = e.target.files[0];
  409. let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
  410. if (extend != 'xls') {
  411. this.$message({ message: '请根据模板进行导入', type: 'error' });
  412. return;
  413. }
  414. e.preventDefault();
  415. let formData = new FormData();
  416. formData.append('file', fileInfo);
  417. formData.append('type', 4);
  418. formData.append('uesrId', localStorage.getItem('uesrId'));
  419. formData.append(
  420. 'hospitalId',
  421. JSON.parse(localStorage.getItem('hospitalLoginDTO')).id
  422. );
  423. const header = {
  424. headers: {
  425. 'Content-Type': 'multipart/form-data'
  426. }
  427. };
  428. this.uploadInfo = '导入中...';
  429. api.importExcelDataVerify(formData, header).then(res => {
  430. if (res.data.code === '00020001') {
  431. this.$confirm(`${res.data.msg}`, '提示1', {
  432. confirmButtonText: '确定',
  433. cancelButtonText: '取消',
  434. type: 'warning'
  435. })
  436. .then(() => {
  437. this.importDiseaseRecord(formData, header)
  438. })
  439. .catch(() => {
  440. setTimeout(() => {
  441. this.uploadInfo = '导入';
  442. }, 300);
  443. });
  444. } else if (res.data.data === true) {
  445. this.importDiseaseRecord(formData, header)
  446. }else {
  447. this.$alert(`${res.data.msg}`, '提示', {
  448. confirmButtonText: '确定',
  449. // cancelButtonText: '取消',
  450. // cancelButtonClass: 'cancelSure',
  451. // confirmButtonClass: 'sure',
  452. // customClass: 'exportConfirm',
  453. type: 'warning'
  454. })
  455. .then(() => {})
  456. .catch(() => {});
  457. setTimeout(() => {
  458. this.uploadInfo = '导入';
  459. }, 300);
  460. }
  461. });
  462. //解决上传相同文件不触发change
  463. let inp = document.getElementById('upFile');
  464. inp.value = '';
  465. },
  466. importDiseaseRecord(formData, header) {
  467. api.importDiseaseRecord(formData, header).then(res => {
  468. if (res.data.code === '00000001') {
  469. this.$alert(`数据存在异常,导入失败,请修改后再试`, '提示', {
  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.$alert(`导入成功`, '提示', {
  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.$alert(`${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. #upFileMatch {
  548. display: none;
  549. }
  550. .delete:hover {
  551. color: red !important;
  552. }
  553. .pagination {
  554. min-width: 1010px;
  555. }
  556. .downTemplate {
  557. margin-right: 8px;
  558. span {
  559. color: #02a7f0;
  560. }
  561. }
  562. #upFile {
  563. display: none !important;
  564. }
  565. .el-message-box {
  566. /deep/.cancelBtn {
  567. background-color: #d7d7d7;
  568. border-color: transparent;
  569. }
  570. /deep/.confirmC {
  571. background-color: #ff545b !important;
  572. border-color: transparent !important;
  573. }
  574. }
  575. .exportBox6 {
  576. .leftbtn {
  577. background-color: #fff !important;
  578. border-color: #48c5d7 !important;
  579. color: #48c5d7 !important;
  580. }
  581. }
  582. </style>