DrugDispensing.vue 32KB

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