prescriptionTemplate.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. <template>
  2. <!--处方模板-->
  3. <div class="main-contain new-main-contain">
  4. <div class="position">
  5. <bread-crumb :crumbs="crumbs"></bread-crumb>
  6. <div class="btn_crumbs">
  7. <el-button type="primary" @click="batchAdds">批量新增</el-button>
  8. <el-button type="primary" @click="batchReplace">批量替换</el-button>
  9. <el-button type="danger" @click="batchDeletes">批量删除</el-button>
  10. <el-button type="primary" @click="add" style="width:70px;">新增</el-button>
  11. </div>
  12. </div>
  13. <div
  14. class="app-container"
  15. style="display: flex; flex: 1; padding: 10px 20px 0px 20px"
  16. >
  17. <div class="mainLeft">
  18. <div class="mainCell" style="margin-bottom: 10px">
  19. <el-input
  20. size="small"
  21. placeholder="请输入姓名或者透析号"
  22. v-model="search_input"
  23. class="filter-item"
  24. @input="searchAction"
  25. @keyup.enter.native="searchAction"
  26. />
  27. <!--<el-button size="small" style="margin-left:10px;" class="filter-item" type="primary"-->
  28. <!--@click="searchAction">-->
  29. <!--搜索-->
  30. <!--</el-button>-->
  31. </div>
  32. <div>
  33. <el-table
  34. :data="data"
  35. :height="tableHeight"
  36. @row-click="choosePatient"
  37. border
  38. style="width: 100%"
  39. :row-style="{ color: '#303133' }"
  40. :header-cell-style="{
  41. backgroundColor: 'rgb(245, 247, 250)',
  42. color: '#606266',
  43. }"
  44. highlight-current-row
  45. ref="tab"
  46. >
  47. <el-table-column type="index" align="center" label="序号" width="60">
  48. </el-table-column>
  49. <el-table-column prop="name" label="姓名">
  50. <template slot-scope="scope"
  51. >{{ scope.row.name }}({{ scope.row.dialysis_no }})</template
  52. >
  53. </el-table-column>
  54. </el-table>
  55. </div>
  56. </div>
  57. <div class="mainRight">
  58. <el-table
  59. :data="templates"
  60. :height="tableHeight"
  61. border
  62. style="width: 100%"
  63. :row-style="{ color: '#303133' }"
  64. :header-cell-style="{
  65. backgroundColor: 'rgb(245, 247, 250)',
  66. color: '#606266',
  67. }"
  68. highlight-current-row
  69. >
  70. <el-table-column prop="name" label="模版名称">
  71. <template slot-scope="scope">{{ scope.row.name }}</template>
  72. </el-table-column>
  73. <el-table-column prop="name" label="透析模式">
  74. <template slot-scope="scope">{{
  75. getMode(scope.row.mode)
  76. }}</template>
  77. </el-table-column>
  78. <el-table-column prop="name" label="操作">
  79. <template slot-scope="scope">
  80. <el-button
  81. size="mini"
  82. type="primary"
  83. @click="jumpDetail(scope.row)"
  84. >编辑</el-button
  85. >
  86. <el-button
  87. size="mini"
  88. type="danger"
  89. @click="deleteTemplate(scope.row)"
  90. >删除</el-button
  91. >
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. <el-pagination
  96. @size-change="handleSizeChange"
  97. @current-change="handleCurrentChange"
  98. :page-sizes="[10, 50, 100]"
  99. :page-size="10"
  100. background
  101. align="right"
  102. style="margin-top: 20px"
  103. layout="total, sizes, prev, pager, next, jumper"
  104. :total="total"
  105. >
  106. </el-pagination>
  107. </div>
  108. </div>
  109. </div>
  110. </template>
  111. <script>
  112. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  113. import {
  114. delHisPrescriptionTemplate,
  115. getPatientListTwenty,
  116. getPrescriptionTemplateList,
  117. } from "@/api/his/his_config";
  118. import { uParseTime } from "@/utils/tools";
  119. const moment = require("moment");
  120. export default {
  121. components: {
  122. BreadCrumb,
  123. },
  124. data() {
  125. return {
  126. crumbs: [
  127. { path: false, name: "门诊医生站" },
  128. { path: false, name: "处方模版" },
  129. ],
  130. search_input: "",
  131. templates: [],
  132. tableHeight: "",
  133. fullHeight: document.documentElement.clientHeight,
  134. isloading: false,
  135. data: [],
  136. all_data: [],
  137. page: 1,
  138. limit: 20,
  139. patient_id: 0,
  140. total: 0,
  141. patient_name: "",
  142. mode_str: "",
  143. };
  144. },
  145. methods: {
  146. // 搜索
  147. searchAction() {
  148. this.data = [];
  149. if (this.search_input.length == 0) {
  150. this.data = this.all_data;
  151. } else {
  152. for (let i = 0; i < this.all_data.length; i++) {
  153. if (
  154. this.all_data[i].name.indexOf(this.search_input) != -1 ||
  155. this.all_data[i].dialysis_no.indexOf(this.search_input) != -1 ||
  156. this.all_data[i].first_letter.indexOf(this.search_input) != -1
  157. ) {
  158. this.data.push(this.all_data[i]);
  159. }
  160. }
  161. }
  162. },
  163. deleteTemplate(row) {
  164. this.$confirm("处方模版删除后不可恢复,是否确认删除", "删除", {
  165. confirmButtonText: "确 定",
  166. cancelButtonText: "取 消",
  167. type: "warning",
  168. })
  169. .then(() => {
  170. let params = {
  171. id: row.id,
  172. };
  173. delHisPrescriptionTemplate(params).then((response) => {
  174. if (response.data.state == 1) {
  175. this.GetPrescriptionTemplateList();
  176. }
  177. });
  178. })
  179. .catch(() => {});
  180. },
  181. jumpDetail(row) {
  182. this.$router.push(
  183. "/hisTool/prescriptionTemplatedetail?id=" +
  184. row.id +
  185. "&patient_id=" +
  186. this.patient_id +
  187. "&patient_name=" +
  188. this.patient_name +
  189. "&modes=" +
  190. this.mode_str
  191. );
  192. },
  193. getMode(id) {
  194. let name = "";
  195. this.treatment_mode = Object.values(this.$store.getters.treatment_mode);
  196. this.treatment_mode.map((item) => {
  197. if (item.id == id) {
  198. name = item.name;
  199. }
  200. });
  201. return name;
  202. },
  203. handleSizeChange(val) {
  204. this.limit = val;
  205. this.GetPrescriptionTemplateList();
  206. },
  207. handleCurrentChange(val) {
  208. this.page = val;
  209. this.GetPrescriptionTemplateList();
  210. },
  211. GetPrescriptionTemplateList() {
  212. let params = {
  213. patient_id: this.patient_id,
  214. page: this.page,
  215. limit: this.limit,
  216. };
  217. getPrescriptionTemplateList(params).then((response) => {
  218. if (response.data.state == 1) {
  219. this.templates = response.data.data.list;
  220. let modes = [];
  221. for (let i = 0; i < this.templates.length; i++) {
  222. modes.push(this.templates[i].mode);
  223. }
  224. this.mode_str = modes.join(",");
  225. this.total = response.data.data.total;
  226. }
  227. });
  228. },
  229. choosePatient(val, column) {
  230. this.page = 1;
  231. this.limit = 10;
  232. this.patient_id = val.id;
  233. this.patient_name = val.name;
  234. this.id = val.id;
  235. sessionStorage.setItem("templateIndex", val.id);
  236. let params = {
  237. patient_id: val.id,
  238. page: this.page,
  239. limit: this.limit,
  240. };
  241. getPrescriptionTemplateList(params).then((response) => {
  242. if (response.data.state == 1) {
  243. this.templates = response.data.data.list;
  244. let modes = [];
  245. for (let i = 0; i < this.templates.length; i++) {
  246. modes.push(this.templates[i].mode);
  247. }
  248. this.mode_str = modes.join(",");
  249. this.total = response.data.data.total;
  250. }
  251. });
  252. },
  253. // 数据源
  254. getList(id) {
  255. getPatientListTwenty().then((response) => {
  256. if (response.data.state == 1) {
  257. this.data = response.data.data.list;
  258. this.all_data = response.data.data.list;
  259. let index = null;
  260. if (
  261. sessionStorage.getItem("templateIndex") &&
  262. sessionStorage.getItem("templateIndex") != ""
  263. ) {
  264. this.data.map((item, i) => {
  265. if (sessionStorage.getItem("templateIndex") == item.id) {
  266. index = i;
  267. }
  268. });
  269. this.$refs.tab.setCurrentRow(this.data[index]);
  270. this.patient_id = this.data[index].id;
  271. this.patient_name = this.data[index].name;
  272. } else {
  273. this.$refs.tab.setCurrentRow(this.data[0]);
  274. this.patient_id = this.data[0].id;
  275. this.patient_name = this.data[0].name;
  276. }
  277. this.GetPrescriptionTemplateList();
  278. }
  279. });
  280. },
  281. getTime(val, temp) {
  282. if (val != 0) {
  283. return uParseTime(val, temp);
  284. } else {
  285. return "";
  286. }
  287. },
  288. batchAdds() {
  289. this.$router.push("/hisTool/batchTemplate");
  290. },
  291. batchDeletes() {
  292. this.$router.push("/hisTool/batchDelete");
  293. },
  294. batchReplace() {
  295. this.$router.push("/hisTool/batchReplacement");
  296. },
  297. add() {
  298. if (this.patient_id == 0) {
  299. this.$message.error("请选择病人");
  300. return;
  301. }
  302. this.$router.push(
  303. "/hisTool/prescriptionTemplatedetail?id=" +
  304. 0 +
  305. "&patient_id=" +
  306. this.patient_id +
  307. "&patient_name=" +
  308. this.patient_name +
  309. "&modes=" +
  310. this.mode_str
  311. );
  312. },
  313. },
  314. created() {
  315. var nowDate = new Date();
  316. var nowYear = nowDate.getFullYear();
  317. var nowMonth = nowDate.getMonth() + 1;
  318. var nowDay = nowDate.getDate();
  319. this.record_date =
  320. nowYear +
  321. "-" +
  322. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  323. "-" +
  324. (nowDay < 10 ? "0" + nowDay : nowDay);
  325. this.getList();
  326. let tableHeight = document.body.clientHeight - 263;
  327. this.tableHeight = tableHeight;
  328. },
  329. mounted() {
  330. const that = this;
  331. window.onresize = () => {
  332. return (() => {
  333. window.fullHeight = document.documentElement.clientHeight;
  334. that.fullHeight = window.fullHeight;
  335. })();
  336. };
  337. },
  338. watch: {
  339. fullHeight(val) {
  340. if (!this.timer) {
  341. this.fullHeight = val;
  342. let tableHeight = val - 263;
  343. this.tableHeight = tableHeight;
  344. this.timer = true;
  345. let that = this;
  346. setTimeout(function () {
  347. that.timer = false;
  348. }, 400);
  349. }
  350. },
  351. },
  352. };
  353. </script>
  354. <style lang="scss" scoped>
  355. .new-main-contain {
  356. height: 100%;
  357. display: flex;
  358. flex-direction: column;
  359. }
  360. .app-container {
  361. height: 100%;
  362. }
  363. .mainCell {
  364. height: 36px;
  365. display: flex;
  366. align-items: center;
  367. }
  368. .mainLeft {
  369. width: 200px;
  370. height: 100%;
  371. display: flex;
  372. flex-direction: column;
  373. .el-radio {
  374. margin-right: 5px;
  375. }
  376. }
  377. .mainRight {
  378. margin-left: 10px;
  379. flex: 1;
  380. height: 100%;
  381. display: flex;
  382. flex-direction: column;
  383. overflow-y: auto;
  384. .cellSpan {
  385. min-width: 80px;
  386. display: inline-block;
  387. margin-right: 10px;
  388. }
  389. }
  390. .mainCenter {
  391. display: flex;
  392. flex: 1;
  393. }
  394. .centerLeft {
  395. flex: 1;
  396. display: flex;
  397. flex-direction: column;
  398. position: relative;
  399. .el-form-item {
  400. width: 32%;
  401. margin-right: 1%;
  402. float: left;
  403. }
  404. .el-form-item__label {
  405. text-align: left;
  406. }
  407. }
  408. .backColor {
  409. background: #f6f8f9;
  410. height: 5px;
  411. margin-bottom: 5px;
  412. }
  413. .tabsBox {
  414. position: relative;
  415. height: 76%;
  416. overflow-y: auto;
  417. margin-bottom: 60px;
  418. .el-tabs__item {
  419. padding: 0 10px;
  420. }
  421. }
  422. .preTabs {
  423. height: 100%;
  424. display: flex;
  425. flex-direction: column;
  426. .el-tabs__content {
  427. flex: 1;
  428. overflow-y: auto;
  429. }
  430. }
  431. .costBox {
  432. width: 100%;
  433. height: 60px;
  434. background: #fff;
  435. position: absolute;
  436. bottom: 0;
  437. display: flex;
  438. align-items: center;
  439. }
  440. .addTab {
  441. position: absolute;
  442. right: 0;
  443. top: 14px;
  444. z-index: 20;
  445. }
  446. .centerRight {
  447. width: 300px;
  448. margin-left: 10px;
  449. display: flex;
  450. flex-direction: column;
  451. position: relative;
  452. }
  453. .rightTab {
  454. height: 40px;
  455. width: 100%;
  456. border: 1px solid #d2d2d2;
  457. box-sizing: border-box;
  458. p {
  459. width: 50%;
  460. height: 40px;
  461. line-height: 40px;
  462. text-align: center;
  463. background: #eee;
  464. float: left;
  465. }
  466. > p:last-child {
  467. border-left: 1px solid #d2d2d2;
  468. float: right;
  469. }
  470. .activeP {
  471. background: #409eff;
  472. color: #fff;
  473. }
  474. }
  475. .comfirmBox {
  476. width: 100%;
  477. height: 60px;
  478. background: #fff;
  479. position: absolute;
  480. bottom: 0;
  481. display: flex;
  482. align-items: center;
  483. justify-content: space-between;
  484. }
  485. .mainHeader {
  486. width: 100%;
  487. background: #fff;
  488. position: fixed;
  489. z-index: 100;
  490. height: 36px;
  491. }
  492. .titleBox {
  493. position: fixed;
  494. z-index: 99;
  495. background: #fff;
  496. }
  497. .fixedCell {
  498. position: fixed;
  499. z-index: 99;
  500. right: 30px;
  501. background: #fff;
  502. width: 300px;
  503. display: flex;
  504. justify-content: space-between;
  505. }
  506. .btn_crumbs {
  507. .el-button {
  508. text-align: center;
  509. font-size: 12px;
  510. padding: 10px 11px;
  511. }
  512. }
  513. </style>
  514. <style lang="scss">
  515. .centerLeft {
  516. .el-form-item__label {
  517. text-align: left;
  518. }
  519. }
  520. .tabsBox {
  521. .el-tabs__item {
  522. padding: 0 10px;
  523. }
  524. .el-tabs--bottom
  525. .el-tabs--left
  526. > .el-tabs__header
  527. .el-tabs__item:nth-child(2),
  528. .el-tabs--bottom
  529. .el-tabs--right
  530. > .el-tabs__header
  531. .el-tabs__item:nth-child(2),
  532. .el-tabs--bottom.el-tabs--border-card
  533. > .el-tabs__header
  534. .el-tabs__item:nth-child(2),
  535. .el-tabs--bottom.el-tabs--card > .el-tabs__header .el-tabs__item:nth-child(2),
  536. .el-tabs--top .el-tabs--left > .el-tabs__header .el-tabs__item:nth-child(2),
  537. .el-tabs--top .el-tabs--right > .el-tabs__header .el-tabs__item:nth-child(2),
  538. .el-tabs--top.el-tabs--border-card
  539. > .el-tabs__header
  540. .el-tabs__item:nth-child(2),
  541. .el-tabs--top.el-tabs--card > .el-tabs__header .el-tabs__item:nth-child(2) {
  542. padding: 0 10px;
  543. }
  544. .el-tabs--bottom .el-tabs--left > .el-tabs__header .el-tabs__item:last-child,
  545. .el-tabs--bottom .el-tabs--right > .el-tabs__header .el-tabs__item:last-child,
  546. .el-tabs--bottom.el-tabs--border-card
  547. > .el-tabs__header
  548. .el-tabs__item:last-child,
  549. .el-tabs--bottom.el-tabs--card > .el-tabs__header .el-tabs__item:last-child,
  550. .el-tabs--top .el-tabs--left > .el-tabs__header .el-tabs__item:last-child,
  551. .el-tabs--top .el-tabs--right > .el-tabs__header .el-tabs__item:last-child,
  552. .el-tabs--top.el-tabs--border-card
  553. > .el-tabs__header
  554. .el-tabs__item:last-child,
  555. .el-tabs--top.el-tabs--card > .el-tabs__header .el-tabs__item:last-child {
  556. padding: 0 10px;
  557. }
  558. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  559. padding: 0 10px;
  560. }
  561. }
  562. .centerRight {
  563. .el-tabs__nav-scroll {
  564. display: flex;
  565. }
  566. .el-tabs__nav {
  567. margin: 0 auto;
  568. }
  569. .el-table th .cell,
  570. .el-table td .cell {
  571. padding: 0 2px;
  572. }
  573. }
  574. .preTabs {
  575. .el-tabs__content {
  576. }
  577. }
  578. .rightTabs {
  579. height: 100%;
  580. .el-tabs__content {
  581. }
  582. }
  583. .centerDialog {
  584. .el-dialog__body {
  585. max-height: calc(100vh - 100px) !important;
  586. padding: 0 20px;
  587. }
  588. }
  589. </style>