tcmdisease.vue 18 KB

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