Disease.vue 17 KB

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