nursing.vue 19 KB

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