tcmdisease.vue 17 KB

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