Disease.vue 18 KB

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