DrugDispensing.vue 31KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093
  1. <template>
  2. <!--药品发药页面-->
  3. <div class="main-contain new-main-contain">
  4. <div class="position">
  5. <!-- <bread-crumb :crumbs='crumbs'></bread-crumb>-->
  6. <bread-crumb :crumbs="crumbs"></bread-crumb>
  7. </div>
  8. <div
  9. class="app-container"
  10. style="display: flex; flex: 1; padding: 10px 20px 0px 20px"
  11. >
  12. <div class="mainLeft">
  13. <div>
  14. <div class="list">
  15. <el-date-picker
  16. style="width: 300px"
  17. v-model="start_time"
  18. type="date"
  19. format="yyyy-MM-dd"
  20. value-format="yyyy-MM-dd"
  21. placeholder="选择日期"
  22. @change="changeTimes()"
  23. >
  24. </el-date-picker>
  25. </div>
  26. <div class="list">
  27. <el-radio-group v-model="state" @change="lala()">
  28. <el-radio :label="1">待发药</el-radio>
  29. <el-radio :label="2">已发药</el-radio>
  30. </el-radio-group>
  31. </div>
  32. <div class="list">
  33. <el-input
  34. size="small"
  35. style="width: 239px"
  36. v-model="keywords"
  37. class="filter-item"
  38. placeholder="请输入药品名称"
  39. />
  40. <el-button
  41. size="small"
  42. class="filter-item"
  43. type="primary"
  44. @click="searchAction"
  45. >搜索
  46. </el-button>
  47. </div>
  48. <el-table
  49. v-if="state == 1"
  50. height="60vh"
  51. :data="waiting_drug"
  52. border
  53. style="width: 100%"
  54. highlight-current-row
  55. ref="table01"
  56. @current-change="handleCurrentChange"
  57. :row-style="{ color: '#303133' }"
  58. :header-cell-style="{
  59. backgroundColor: 'rgb(245, 247, 250)',
  60. color: '#606266',
  61. }"
  62. >
  63. <el-table-column prop="name" label="名称" width="100">
  64. <template slot-scope="scope">
  65. {{ scope.row.name }}
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="specifications" label="规格" width="100">
  69. <template slot-scope="scope">
  70. {{ scope.row.specifications }}
  71. </template>
  72. </el-table-column>
  73. <el-table-column prop="stock" label="库存" width="100">
  74. <template slot-scope="scope">
  75. {{ scope.row.stock }}
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <el-table
  80. v-if="state == 2"
  81. :height="tableHeight"
  82. :data="issued_drug"
  83. border
  84. style="width: 100%"
  85. highlight-current-row
  86. @current-change="handleCurrentChange"
  87. :row-style="{ color: '#303133' }"
  88. :header-cell-style="{
  89. backgroundColor: 'rgb(245, 247, 250)',
  90. color: '#606266',
  91. }"
  92. ref="table02"
  93. >
  94. <el-table-column prop="name" label="名称" width="100">
  95. <template slot-scope="scope">
  96. {{ scope.row.name }}
  97. </template>
  98. </el-table-column>
  99. <el-table-column prop="specifications" label="规格" width="100">
  100. <template slot-scope="scope">
  101. {{ scope.row.specifications }}
  102. </template>
  103. </el-table-column>
  104. <el-table-column prop="stock" label="库存" width="100">
  105. <template slot-scope="scope">
  106. {{ scope.row.stock }}
  107. </template>
  108. </el-table-column>
  109. </el-table>
  110. </div>
  111. </div>
  112. <div class="mainRight">
  113. <div class="titlelist">
  114. <!-- 班次:
  115. <el-select
  116. v-model="shift"
  117. placeholder="请选择"
  118. @change="getdrugsdetails"
  119. >
  120. <el-option
  121. v-for="item in banshift"
  122. :key="item.value"
  123. :label="item.text"
  124. :value="item.value"
  125. >
  126. </el-option>
  127. </el-select>
  128. 分区:
  129. <el-select
  130. v-model="partition"
  131. placeholder="请选择"
  132. @change="getdrugsdetails"
  133. >
  134. <el-option
  135. v-for="item in fen"
  136. :key="item.id"
  137. :label="item.name"
  138. :value="item.id"
  139. >
  140. </el-option>
  141. </el-select>
  142. 给药途径:
  143. <el-select
  144. v-model="deliveryway"
  145. placeholder="请选择"
  146. @change="getdruglist02"
  147. >
  148. <el-option
  149. v-for="item in routeofadministration"
  150. :key="item.name"
  151. :label="item.name"
  152. :value="item.name"
  153. >
  154. </el-option>
  155. </el-select> -->
  156. <el-button type="primary" @click="toExport" v-if="state == 2"
  157. >导出</el-button
  158. >
  159. <!-- <el-button type="primary" @click="tt">调试</el-button>-->
  160. <el-button type="primary" @click="dispense" v-if="state == 1"
  161. >发药</el-button
  162. >
  163. <!-- <el-button type="primary" @click="toPrint">打印</el-button> -->
  164. <!-- <el-button @click="tt">调试</el-button>-->
  165. </div>
  166. <el-divider></el-divider>
  167. <div class="right_table">
  168. <el-table
  169. :height="tableHeight"
  170. :data="tableData"
  171. :summary-method="getSummaries"
  172. show-summary
  173. border
  174. highlight-current-row
  175. style="width: 1328px"
  176. :row-style="{ color: '#303133' }"
  177. :header-cell-style="{
  178. backgroundColor: 'rgb(245, 247, 250)',
  179. color: '#606266',
  180. }"
  181. @selection-change="handleSelectionChange"
  182. v-if="state == 1"
  183. >
  184. <el-table-column type="selection" width="55" align="center">
  185. </el-table-column>
  186. <el-table-column
  187. type="index"
  188. label="序号"
  189. width="120"
  190. align="center"
  191. >
  192. </el-table-column>
  193. <el-table-column
  194. prop="name"
  195. label="患者名称"
  196. width="180"
  197. align="center"
  198. >
  199. <template slot-scope="scope">
  200. {{ scope.row.name }}
  201. </template>
  202. </el-table-column>
  203. <el-table-column
  204. prop="name"
  205. label="单次用量"
  206. width="170"
  207. align="center"
  208. >
  209. <template slot-scope="scope">
  210. {{ scope.row.single_dosage }}
  211. </template>
  212. </el-table-column>
  213. <el-table-column
  214. prop="name"
  215. label="用法"
  216. width="160"
  217. align="center"
  218. >
  219. <template slot-scope="scope">
  220. {{ scope.row.usage }}
  221. </template>
  222. </el-table-column>
  223. <el-table-column
  224. prop="name"
  225. label="频率"
  226. width="160"
  227. align="center"
  228. >
  229. <template slot-scope="scope">
  230. {{ scope.row.frequency }}
  231. </template>
  232. </el-table-column>
  233. <el-table-column
  234. prop="name"
  235. label="天数"
  236. width="160"
  237. align="center"
  238. >
  239. <template slot-scope="scope">
  240. {{ scope.row.days }}
  241. </template>
  242. </el-table-column>
  243. <el-table-column
  244. prop="name"
  245. label="总量"
  246. width="160"
  247. align="center"
  248. >
  249. <template slot-scope="scope">
  250. {{ scope.row.total }}
  251. </template>
  252. </el-table-column>
  253. <el-table-column
  254. prop="name"
  255. label="数据来源"
  256. width="162"
  257. align="center"
  258. >
  259. <template slot-scope="scope">
  260. {{ scope.row.data_sources }}
  261. </template>
  262. </el-table-column>
  263. </el-table>
  264. </div>
  265. <div>
  266. <el-table
  267. :height="tableHeight"
  268. :data="tableData"
  269. border
  270. style="width: 1328px"
  271. v-if="state == 2"
  272. >
  273. <!-- <el-table-column type="selection" width="55"> </el-table-column>-->
  274. <el-table-column
  275. type="index"
  276. label="序号"
  277. width="120"
  278. align="center"
  279. >
  280. </el-table-column>
  281. <el-table-column
  282. prop="name"
  283. label="患者名称"
  284. width="180"
  285. align="center"
  286. >
  287. <template slot-scope="scope">
  288. {{ scope.row.name }}
  289. </template>
  290. </el-table-column>
  291. <el-table-column
  292. prop="name"
  293. label="单次用量"
  294. width="170"
  295. align="center"
  296. >
  297. <template slot-scope="scope">
  298. {{ scope.row.single_dosage }}
  299. </template>
  300. </el-table-column>
  301. <el-table-column
  302. prop="name"
  303. label="用法"
  304. width="160"
  305. align="center"
  306. >
  307. <template slot-scope="scope">
  308. {{ scope.row.usage }}
  309. </template>
  310. </el-table-column>
  311. <el-table-column
  312. prop="name"
  313. label="频率"
  314. width="160"
  315. align="center"
  316. >
  317. <template slot-scope="scope">
  318. {{ scope.row.frequency }}
  319. </template>
  320. </el-table-column>
  321. <el-table-column
  322. prop="name"
  323. label="天数"
  324. width="160"
  325. align="center"
  326. >
  327. <template slot-scope="scope">
  328. {{ scope.row.days }}
  329. </template>
  330. </el-table-column>
  331. <el-table-column
  332. prop="name"
  333. label="总量"
  334. width="160"
  335. align="center"
  336. >
  337. <template slot-scope="scope">
  338. {{ scope.row.total }}
  339. </template>
  340. </el-table-column>
  341. <el-table-column
  342. prop="name"
  343. label="数据来源"
  344. width="162"
  345. align="center"
  346. >
  347. <template slot-scope="scope">
  348. {{ scope.row.data_sources }}
  349. </template>
  350. </el-table-column>
  351. <el-table-column
  352. prop="name"
  353. label="领药人"
  354. width="160"
  355. align="center"
  356. >
  357. <template slot-scope="scope">
  358. {{ scope.row.people }}
  359. </template>
  360. </el-table-column>
  361. </el-table>
  362. </div>
  363. <!-- <div style="background-color: #f5f7fa;display:flex;padding: 10px;justify-content:space-around;position:absolute;width:75.6%;margin-top: 27.5%;
  364. "><div style="width: 40%;padding-left:3%">合计 </div> <div style="width: 40%;display: flex;justify-content:center;padding-left: 37%">{{total}}</div></div> -->
  365. <div style="margin-top: 25px" v-if="state == 1">
  366. 领药人:
  367. <el-select v-model="admin_user_id" placeholder="请选择">
  368. <el-option
  369. v-for="item in doctorList"
  370. :key="item.admin_user_id"
  371. :label="item.user_name"
  372. :value="item.admin_user_id"
  373. >
  374. </el-option>
  375. </el-select>
  376. </div>
  377. </div>
  378. <el-dialog title="设置" :visible.sync="dialogVisible" width="30%">
  379. <span style="font-size: 17px">请选择药品是否要通过药房管理出库</span>
  380. <span style="display: block; padding: 18px 25px">
  381. <el-radio v-model="is_open" label="1">是</el-radio>
  382. <el-radio v-model="is_open" label="2">否</el-radio>
  383. </span>
  384. <div
  385. style="
  386. height: 50px;
  387. background: #c7ebfc;
  388. border-radius: 5px;
  389. padding: 7px;
  390. "
  391. >
  392. <i class="el-icon-info" style="color: #3399ff; font-size: 17px"></i>
  393. 若选择为是,则通过药房发药的药品都会在发药之后进行出库,否则按原来的方式进行出库管理
  394. </div>
  395. <span slot="footer" class="dialog-footer">
  396. <el-button @click="dialogVisible = false">取 消</el-button>
  397. <el-button type="primary" @click="SaveSetting">保 存</el-button>
  398. </span>
  399. </el-dialog>
  400. </div>
  401. <drug-print
  402. ref="drugprint"
  403. :visibility="isVisibility"
  404. :propsTable="propsTable"
  405. :state="state"
  406. >
  407. </drug-print>
  408. </div>
  409. </template>
  410. <script>
  411. import drugPrint from "./print/drugPrint.vue";
  412. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  413. import {
  414. getTodayAdviceList,
  415. getPharmacyBaseDrug,
  416. updatePharmacyBaseDrug,
  417. SaveSetting,
  418. getPharmacyConfig,
  419. getUserdDrugList,
  420. } from "@/api/his/advice";
  421. import {
  422. dispensemedicine,
  423. waitingmedicine,
  424. getpatientswithdrugs,
  425. medicinedeparture,
  426. getcurrentname,
  427. getpartitionlist,
  428. routeofadministration,
  429. } from "@/api/pharmacy";
  430. const moment = require("moment");
  431. export default {
  432. components: {
  433. BreadCrumb,
  434. drugPrint,
  435. },
  436. data() {
  437. return {
  438. crumbs: [
  439. { path: false, name: "药房管理" },
  440. { path: "/Pharmacy/DrugDispensing", name: "药品发药" },
  441. ],
  442. tableHeight: 490,
  443. datepick: "",
  444. state: 1,
  445. waitmount: 0,
  446. alreadmount: 0,
  447. tableData: [],
  448. tableData_list: [],
  449. tableList: [],
  450. multipleSelection: [],
  451. start_time: moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
  452. patientList: [],
  453. keywords: "",
  454. dialogVisible: false,
  455. is_open: "2",
  456. isVisibility: "",
  457. propsTable: "",
  458. doctorList: [],
  459. admin_user_id: 0,
  460. waiting_drug: [], //待发药列表
  461. issued_drug: [], //已发药列表
  462. currentRow: null,
  463. tmp: 0,
  464. banshift: [
  465. { value: 0, text: "全部班" },
  466. { value: 1, text: "上午" },
  467. { value: 2, text: "下午" },
  468. { value: 3, text: "晚上" },
  469. ],
  470. shift: 0, //班次
  471. fen: [],
  472. partition: 0, //分区
  473. routeofadministration: [],
  474. deliveryway: "全部", //给药途径
  475. total: "", //合计
  476. };
  477. },
  478. methods: {
  479. tt() {
  480. console.log("this.state", this.state);
  481. console.log("this.tableData", this.tableData);
  482. console.log("this.deliveryway", this.deliveryway);
  483. },
  484. async fun3() {
  485. console.log("fun3");
  486. this.fun1().then((val) => {
  487. this.fun2();
  488. });
  489. },
  490. async fun4(tps) {
  491. console.log("fun3", tps);
  492. this.fun1().then((val) => {
  493. console.log("this.issued_drug", this.issued_drug);
  494. for (let i = 0; i < this.issued_drug.length; i++) {
  495. if (tps == this.issued_drug[i].id) {
  496. this.$refs.table02.setCurrentRow(this.issued_drug[i]);
  497. this.handleCurrentChange(this.issued_drug[i]);
  498. }
  499. }
  500. });
  501. },
  502. async fun5(tps) {
  503. console.log("fun3", tps);
  504. this.fun1().then((val) => {
  505. console.log("this.issued_drug", this.waiting_drug);
  506. for (let i = 0; i < this.waiting_drug.length; i++) {
  507. if (tps == this.waiting_drug[i].id) {
  508. this.$refs.table01.setCurrentRow(this.waiting_drug[i]);
  509. this.handleCurrentChange(this.waiting_drug[i]);
  510. }
  511. }
  512. });
  513. },
  514. getSummaries(param) {
  515. const { columns, data } = param;
  516. const sums = [];
  517. columns.forEach((column, index) => {
  518. if (index === 0) {
  519. sums[index] = "合计";
  520. return;
  521. }
  522. if (index === 7) {
  523. sums[index] = this.total;
  524. return;
  525. }
  526. });
  527. return sums;
  528. },
  529. changeTimes() {
  530. // alert("aa")
  531. // this.getdruglist();
  532. this.fun3();
  533. },
  534. //初始化
  535. init() {
  536. this.state = 1;
  537. this.tableData = null;
  538. this.currentRow = null;
  539. },
  540. lala() {
  541. this.currentRow = null;
  542. this.tableData = null;
  543. this.selectedbydefault();
  544. },
  545. searchAction() {
  546. // this.getlist();
  547. this.tableData = null;
  548. this.currentRow = null;
  549. this.getdruglist();
  550. },
  551. // 跳转打印页面
  552. toPrint() {
  553. if (this.state == 1 && this.multipleSelection.length == 0) {
  554. this.$message.error("未选择任何数据");
  555. return;
  556. }
  557. if (this.state == 2 && this.tableData == null) {
  558. this.$message.error("未选择任何数据");
  559. return;
  560. }
  561. this.$refs.drugprint.show(
  562. this.tableData,
  563. this.currentRow,
  564. this.state,
  565. this.multipleSelection,
  566. this.start_time
  567. );
  568. },
  569. toExport() {
  570. if (this.state == 1 && this.multipleSelection.length == 0) {
  571. this.$message.error("未选择任何数据");
  572. return;
  573. }
  574. if (this.state == 2 && this.tableData == null) {
  575. this.$message.error("未选择任何数据");
  576. return;
  577. }
  578. // for (let i = 0; i < this.tableData.length; i++) {
  579. // this.tableData[i].index = i + 1;
  580. // this.tableData[i].name = this.tableData[i].dose + this.tableData[i].dose_unit + "*" + this.tableData[i].min_number + this.tableData[i].min_unit +
  581. // "/" +
  582. // this.tableData[i].max_unit;
  583. //
  584. // this.tableData[i].total_price = (
  585. // this.tableData[i].warehousing_count * this.exportList[i].price
  586. // ).toFixed(2);
  587. // for (let j = 0; j < this.manufacturerList.length; j++) {
  588. // if (this.exportList[i].manufacturer == this.manufacturerList[j].id) {
  589. // this.exportList[i].manufacturer =
  590. // this.manufacturerList[j].manufacturer_name;
  591. // }
  592. // if (this.exportList[i].manufacturer == 0) {
  593. // this.exportList[i].manufacturer = "";
  594. // }
  595. // }
  596. //
  597. // for (let z = 0; z < this.dealerList.length; z++) {
  598. // if (this.exportList[i].dealer == this.dealerList[z].id) {
  599. // this.exportList[i].dealer = this.dealerList[z].dealer_name;
  600. // }
  601. // if (this.exportList[i].dealer == 0) {
  602. // this.exportList[i].dealer = "";
  603. // }
  604. // }
  605. // }
  606. if (this.state == 1) {
  607. import("@/vendor/Export2Excel").then((excel) => {
  608. for (let i = 0; i < this.multipleSelection.length; i++) {
  609. this.multipleSelection[i].index = i + 1;
  610. this.multipleSelection[i].time = this.start_time;
  611. this.multipleSelection[i].yname = this.currentRow.name;
  612. }
  613. const tHeader = [
  614. "序号",
  615. "时间",
  616. "患者名称",
  617. "药品名称",
  618. "单次用量",
  619. "用法",
  620. "频率",
  621. "天数",
  622. "总量",
  623. "数据来源",
  624. ];
  625. const filterVal = [
  626. "index",
  627. "time",
  628. "name",
  629. "yname",
  630. "single_dosage",
  631. "usage",
  632. "frequency",
  633. "days",
  634. "total",
  635. "data_sources",
  636. ];
  637. const data = this.formatJson(filterVal, this.multipleSelection);
  638. excel.export_json_to_excel({
  639. header: tHeader,
  640. data,
  641. filename: "发药单详情",
  642. });
  643. this.downloadLoading = false;
  644. });
  645. } else if (this.state == 2) {
  646. import("@/vendor/Export2Excel").then((excel) => {
  647. for (let i = 0; i < this.tableData.length; i++) {
  648. this.tableData[i].index = i + 1;
  649. this.tableData[i].time = this.start_time;
  650. this.tableData[i].yname = this.currentRow.name;
  651. }
  652. const tHeader = [
  653. "序号",
  654. "日期",
  655. "患者名称",
  656. "药品名称",
  657. "单次用量",
  658. "用法",
  659. "频率",
  660. "天数",
  661. "总量",
  662. "数据来源",
  663. "领药人",
  664. ];
  665. const filterVal = [
  666. "index",
  667. "time",
  668. "name",
  669. "yname",
  670. "single_dosage",
  671. "usage",
  672. "frequency",
  673. "days",
  674. "total",
  675. "data_sources",
  676. "people",
  677. ];
  678. const data = this.formatJson(filterVal, this.tableData);
  679. excel.export_json_to_excel({
  680. header: tHeader,
  681. data,
  682. filename: "发药单详情",
  683. });
  684. this.downloadLoading = false;
  685. });
  686. } else {
  687. this.$message.error("药品状态异常");
  688. return;
  689. }
  690. // import("@/vendor/Export2Excel").then((excel) => {
  691. // // for (let i = 0; i < this.tableData.length; i++) {
  692. // // for (let j = 0; j < this.drugTypeList.length; j++) {
  693. // // if (this.exportList[i].drug_type == this.drugTypeList[j].id) {
  694. // // this.exportList[i].drug_type = this.drugTypeList[j].name;
  695. // // }
  696. // // }
  697. // // }
  698. //
  699. // const tHeader = [
  700. // "序号",
  701. // "患者名称",
  702. // "单次用量",
  703. // "用法",
  704. // "频率",
  705. // "天数",
  706. // "总量",
  707. // "数据来源",
  708. // ];
  709. // const filterVal = [
  710. // "index",
  711. // "drug_name",
  712. // "drug_type",
  713. // "unit",
  714. // "batch_number",
  715. // "warehousing_count",
  716. // "price",
  717. // "total_price",
  718. // ];
  719. //
  720. // const data = this.tableData;
  721. // excel.export_json_to_excel({
  722. // header: tHeader,
  723. // data,
  724. // filename: "药品入库单详情",
  725. // });
  726. // this.downloadLoading = false;
  727. // });
  728. },
  729. formatJson(filterVal, jsonData) {
  730. return jsonData.map((v) => filterVal.map((j) => v[j]));
  731. },
  732. //列表选择
  733. handleSelectionChange(val) {
  734. this.multipleSelection = val;
  735. },
  736. //默认选中
  737. selectedbydefault() {
  738. if (this.state == 1 && this.waiting_drug.length > 0) {
  739. this.$refs.table01.setCurrentRow(this.waiting_drug[0]);
  740. this.handleCurrentChange(this.waiting_drug[0]);
  741. }
  742. if (this.state == 2 && this.issued_drug.length > 0) {
  743. this.$refs.table02.setCurrentRow(this.issued_drug[0]);
  744. this.handleCurrentChange(this.issued_drug[0]);
  745. }
  746. },
  747. //包装selectedbydefault
  748. fun2() {
  749. console.log("3333333this.waitmount_data", this.waiting_drug);
  750. // return new Promise((resolve, reject) => {
  751. if (this.state == 1 && this.waiting_drug.length > 0) {
  752. this.$refs.table01.setCurrentRow(this.waiting_drug[0]);
  753. this.handleCurrentChange(this.waiting_drug[0]);
  754. }
  755. if (this.state == 2 && this.issued_drug.length > 0) {
  756. this.$refs.table02.setCurrentRow(this.issued_drug[0]);
  757. this.handleCurrentChange(this.issued_drug[0]);
  758. }
  759. // });
  760. },
  761. // 药品发药
  762. dispense() {
  763. var tps = this.currentRow.id;
  764. if (this.multipleSelection.length < 1) {
  765. this.$message.error("未选择任何信息");
  766. return;
  767. }
  768. var tmp = "";
  769. for (var i = 0; i < this.multipleSelection.length; i++) {
  770. tmp = tmp + this.multipleSelection[i].id + ",";
  771. }
  772. var params = {
  773. creater: this.admin_user_id,
  774. ids: tmp,
  775. };
  776. this.$confirm("确定是否对该药品进行发药?", "患者发药", {
  777. confirmButtonText: "确 定",
  778. cancelButtonText: "取 消",
  779. type: "warning",
  780. }).then(() => {
  781. medicinedeparture(params).then((res) => {
  782. if (res.data.state == 1) {
  783. this.$message.success("操作成功");
  784. this.getdruglist();
  785. //刷新列表
  786. this.handleCurrentChange(this.currentRow);
  787. this.fun4(tps);
  788. this.state = 2;
  789. this.multipleSelection = [];
  790. } else {
  791. this.$message.error("操作失败:" + res.data.msg);
  792. //刷新列表
  793. this.handleCurrentChange(this.currentRow);
  794. this.fun5(tps);
  795. this.state = 1;
  796. }
  797. });
  798. });
  799. },
  800. //获取药品列表
  801. getdruglist02() {
  802. // var tps = this.currentRow.id;
  803. this.tableData = [];
  804. var params = {
  805. keyword: this.keywords,
  806. time: this.start_time,
  807. deliveryway: this.deliveryway,
  808. };
  809. waitingmedicine(params).then((res) => {
  810. if (res.data.state == 1) {
  811. this.waiting_drug = res.data.data.list;
  812. }
  813. });
  814. dispensemedicine(params).then((res) => {
  815. if (res.data.state == 1) {
  816. this.issued_drug = res.data.data.list;
  817. }
  818. });
  819. if (this.state == 2) {
  820. this.handleCurrentChange(this.currentRow);
  821. // this.fun5(tps);
  822. }else{
  823. this.handleCurrentChange(this.currentRow);
  824. // this.fun4(tps);
  825. }
  826. },
  827. //获取药品列表
  828. getdruglist() {
  829. var params = {
  830. keyword: this.keywords,
  831. time: this.start_time,
  832. deliveryway: this.deliveryway,
  833. };
  834. waitingmedicine(params).then((res) => {
  835. if (res.data.state == 1) {
  836. this.waiting_drug = res.data.data.list;
  837. }
  838. });
  839. dispensemedicine(params).then((res) => {
  840. if (res.data.state == 1) {
  841. this.issued_drug = res.data.data.list;
  842. }
  843. });
  844. },
  845. async fun1() {
  846. var params = {
  847. keyword: this.keywords,
  848. time: this.start_time,
  849. deliveryway: this.deliveryway,
  850. };
  851. await waitingmedicine(params).then((res) => {
  852. if (res.data.state == 1) {
  853. this.waiting_drug = res.data.data.list;
  854. }
  855. console.log("fun1lil1111i");
  856. });
  857. await dispensemedicine(params).then((res) => {
  858. if (res.data.state == 1) {
  859. this.issued_drug = res.data.data.list;
  860. }
  861. console.log("fun122222222");
  862. });
  863. console.log("fun1");
  864. },
  865. morencreatename() {
  866. var param = {};
  867. getcurrentname(param).then((res) => {
  868. console.log("res(药)", res);
  869. if (res.data.state == 1) {
  870. this.admin_user_id = res.data.data.list;
  871. console.log("this.admin_user_id(药)", this.admin_user_id);
  872. }
  873. });
  874. },
  875. //获取领药人选项
  876. getlist() {
  877. var params = {
  878. start_time: this.start_time,
  879. keywords: this.keywords,
  880. };
  881. getTodayAdviceList(params).then((response) => {
  882. if (response.data.state == 1) {
  883. this.doctorList = response.data.data.doctorlist;
  884. console.log("this.admin_user_id(药2)", this.admin_user_id);
  885. // this.admin_user_id = this.doctorList[0].admin_user_id
  886. // this.admin_user_id = this.tmp
  887. }
  888. });
  889. },
  890. // //获取药品的患者信息
  891. informationofdrugs(val) {
  892. var params = {
  893. // patient_id: this.currentRow.
  894. };
  895. },
  896. handleCurrentChange(val) {
  897. this.currentRow = val;
  898. console.log("currentRow", this.currentRow);
  899. this.total = "";
  900. if (this.state == 1) {
  901. this.getdrugsdetails(0);
  902. }
  903. if (this.state == 2) {
  904. this.getdrugsdetails(1);
  905. }
  906. },
  907. getdrugsdetails(val) {
  908. if(this.state == 1){
  909. val = 0
  910. }else{
  911. val = 1
  912. }
  913. var params = {
  914. drug_id: this.currentRow.id,
  915. is_medicine: val,
  916. time: this.start_time,
  917. shift: this.shift,
  918. partition: this.partition,
  919. deliveryway: this.deliveryway,
  920. };
  921. getpatientswithdrugs(params).then((res) => {
  922. if (res.data.state == 1) {
  923. this.tableData = res.data.data.list; //列表数据
  924. this.total = res.data.data.total; //合计
  925. } else {
  926. this.$message.error(res.data.msg);
  927. }
  928. });
  929. },
  930. toSetting() {
  931. getPharmacyConfig().then((response) => {
  932. if (response.data.state == 1) {
  933. this.dialogVisible = true;
  934. var config = response.data.data.config;
  935. this.is_open = config.is_open.toString();
  936. }
  937. });
  938. },
  939. SaveSetting() {
  940. var params = {
  941. is_open: parseInt(this.is_open),
  942. };
  943. SaveSetting(params).then((response) => {
  944. if (response.data.state == 1) {
  945. var config = response.data.data.config;
  946. this.$message.success("保存成功!");
  947. this.dialogVisible = false;
  948. }
  949. });
  950. },
  951. getrouteofadministration() {
  952. var params = {};
  953. routeofadministration(params).then((res) => {
  954. if (res.data.state == 1) {
  955. this.routeofadministration = res.data.data.list;
  956. }
  957. });
  958. },
  959. getgetpartitionlist() {
  960. var params = {};
  961. getpartitionlist(params).then((res) => {
  962. this.fen = res.data.data.list;
  963. });
  964. },
  965. getUserlist(drug_id) {
  966. var params = {
  967. start_time: this.start_time,
  968. drug_id: drug_id,
  969. };
  970. getUserdDrugList(params).then((response) => {
  971. if (response.data.state == 1) {
  972. var advicelist = response.data.data.advicelist;
  973. for (let i = 0; i < advicelist.length; i++) {
  974. advicelist[i].type = 1;
  975. advicelist[i].day = " ";
  976. this.tableList.push(advicelist[i]);
  977. }
  978. var hisAdviceList = response.data.data.hisAdviceList;
  979. for (let i = 0; i < hisAdviceList.length; i++) {
  980. hisAdviceList[i].type = 2;
  981. this.tableList.push(hisAdviceList[i]);
  982. }
  983. var patient = response.data.data.patient;
  984. this.patientList = patient;
  985. }
  986. });
  987. },
  988. },
  989. created() {
  990. this.init();
  991. this.morencreatename();
  992. this.getlist();
  993. // this.getdruglist();
  994. this.fun3();
  995. this.getrouteofadministration();
  996. this.getgetpartitionlist();
  997. },
  998. };
  999. </script>
  1000. <style rel="stylesheet/css" lang="scss" scoped>
  1001. .new-main-contain {
  1002. height: 100%;
  1003. display: flex;
  1004. flex-direction: column;
  1005. }
  1006. .app-container {
  1007. height: 100%;
  1008. }
  1009. .mainLeft {
  1010. width: 300px;
  1011. height: 100%;
  1012. display: flex;
  1013. flex-direction: column;
  1014. .el-radio {
  1015. margin-right: 75px;
  1016. }
  1017. .list {
  1018. margin: 10px 0;
  1019. }
  1020. }
  1021. .mainRight {
  1022. margin-left: 10px;
  1023. flex: 1;
  1024. height: 100%;
  1025. display: flex;
  1026. flex-direction: column;
  1027. overflow-y: auto;
  1028. .titlelist {
  1029. display: flex;
  1030. justify-content: flex-end;
  1031. }
  1032. .el-button {
  1033. height: 34px;
  1034. width: 65px;
  1035. }
  1036. .el-table {
  1037. margin-top: -13px;
  1038. }
  1039. /deep/ .el-divider {
  1040. height: 2px;
  1041. margin-top: 10px;
  1042. }
  1043. }
  1044. /deep/ .el-table--scrollable-x .el-table__body-wrapper {
  1045. overflow-y: auto;
  1046. overflow-x: hidden;
  1047. }
  1048. .right_table{
  1049. /deep/ .el-table--scrollable-x .el-table__body-wrapper {
  1050. overflow-y: auto;
  1051. overflow-x: scroll;
  1052. }
  1053. }
  1054. /deep/ .gutter {
  1055. width: 15px !important;
  1056. display: inline-block !important;
  1057. }
  1058. /deep/ .el-table__fixed-right-patch {
  1059. width: 15px !important;
  1060. }
  1061. /deep/ .el-table__fixed-right {
  1062. bottom: 0 !important;
  1063. left: auto;
  1064. right: 0;
  1065. }
  1066. /deep/ .el-table__body-wrapper::-webkit-scrollbar {
  1067. width: 15px !important;
  1068. height: 15px !important;
  1069. }
  1070. </style>