tcmdisease.vue 19 KB

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