DrugDispensing.vue 32KB

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