PatientDispensing.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  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: 200px"
  17. v-model="datepick"
  18. type="date"
  19. placeholder="选择日期"
  20. >
  21. </el-date-picker>
  22. </div>
  23. <!-- <el-button @click="testsss">调试1</el-button>-->
  24. <!-- <el-button @click="testsss2">调试2</el-button>-->
  25. <div class="list">
  26. <el-radio-group v-model="state" @change="lala()">
  27. <el-radio :label="1">待发药{{ waitmount }}人</el-radio>
  28. <el-radio :label="2">已发药{{ alreadmount }}人</el-radio>
  29. </el-radio-group>
  30. </div>
  31. <div
  32. class="list"
  33. style="display: flex; justify-content: space-between"
  34. >
  35. <el-input
  36. size="small"
  37. style="width: 130px"
  38. v-model="keywords"
  39. class="filter-item"
  40. placeholder="请输入患者名称"
  41. />
  42. <el-button
  43. size="small"
  44. class="filter-item"
  45. type="primary"
  46. @click="searchAction"
  47. >搜索
  48. </el-button>
  49. </div>
  50. <el-table
  51. :height="tableHeight"
  52. ref="table01"
  53. :data="waitmount_data"
  54. highlight-current-row
  55. @current-change="handleCurrentChange"
  56. border
  57. style="width: 100%"
  58. v-if="state == 1"
  59. >
  60. <el-table-column prop="date" label="患者姓名" width="100">
  61. <template slot-scope="scope">
  62. <span>{{ scope.row.Name ? scope.row.Name : "" }}</span>
  63. </template>
  64. </el-table-column>
  65. <el-table-column prop="name" label="透析号" width="100">
  66. <template slot-scope="scope">
  67. <span>{{
  68. scope.row.DialysisNo ? scope.row.DialysisNo : ""
  69. }}</span>
  70. </template>
  71. </el-table-column>
  72. </el-table>
  73. <el-table
  74. :height="tableHeight"
  75. ref="table02"
  76. :data="alreadmount_data"
  77. highlight-current-row
  78. @current-change="handleCurrentChange"
  79. border
  80. style="width: 100%"
  81. v-if="state == 2"
  82. >
  83. <el-table-column prop="date" label="患者姓名" width="100">
  84. <template slot-scope="scope">
  85. <span>{{ scope.row.Name ? scope.row.Name : "" }}</span>
  86. </template>
  87. </el-table-column>
  88. <el-table-column prop="name" label="透析号" width="100">
  89. <template slot-scope="scope">
  90. <span>{{
  91. scope.row.DialysisNo ? scope.row.DialysisNo : ""
  92. }}</span>
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. </div>
  97. </div>
  98. <div class="mainRight">
  99. <div class="titlelist">
  100. <el-button type="primary" @click="dispense" v-if="state == 1"
  101. >发药</el-button
  102. >
  103. <el-button type="primary" @click="endispense" v-if="state == 2"
  104. >退药</el-button
  105. >
  106. <el-button type="primary" @click="toPrint">打印</el-button>
  107. <!-- <el-button @click="tiaoshi">调试</el-button>-->
  108. <el-button type="primary" v-if="state == 1" @click="toSetting"
  109. >设置</el-button
  110. >
  111. </div>
  112. <el-divider></el-divider>
  113. <div>
  114. <el-table
  115. :height="tableHeight"
  116. :data="tableData_list"
  117. border
  118. style="width: 100%"
  119. >
  120. <el-table-column
  121. type="index"
  122. label="序号"
  123. width="120"
  124. align="center"
  125. >
  126. </el-table-column>
  127. <el-table-column label="名称" width="200" align="center">
  128. <template slot-scope="scope">
  129. <span>{{ scope.row.Name ? scope.row.Name : "" }}</span>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="单次用量" width="150" align="center">
  133. <template slot-scope="scope">
  134. <span>{{
  135. scope.row.SingleDosage ? scope.row.SingleDosage : ""
  136. }}</span>
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="用法" width="160" align="center">
  140. <template slot-scope="scope">
  141. <span>{{ scope.row.Usage ? scope.row.Usage : "" }}</span>
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="频率" width="160" align="center">
  145. <template slot-scope="scope">
  146. <span>{{
  147. scope.row.Frequency ? scope.row.Frequency : ""
  148. }}</span>
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="天数" width="140" align="center">
  152. <template slot-scope="scope">
  153. <span>{{ scope.row.Days ? scope.row.Days : "" }}</span>
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="总量" width="140" align="center">
  157. <template slot-scope="scope">
  158. <span>{{ scope.row.Total ? scope.row.Total : "" }}</span>
  159. </template>
  160. </el-table-column>
  161. <el-table-column label="开立医生" width="150" align="center">
  162. <template slot-scope="scope">
  163. <span>{{ scope.row.Doctor ? scope.row.Doctor : "" }}</span>
  164. </template>
  165. </el-table-column>
  166. <el-table-column label="数据来源" width="162" align="center">
  167. <template slot-scope="scope">
  168. <span>{{
  169. scope.row.DataSources ? scope.row.DataSources : ""
  170. }}</span>
  171. </template>
  172. </el-table-column>
  173. <el-table-column label="备注" width="170" align="center">
  174. <template slot-scope="scope">
  175. <span>{{ scope.row.Remarks ? scope.row.Remarks : "" }}</span>
  176. </template>
  177. </el-table-column>
  178. </el-table>
  179. </div>
  180. <!-- <div v-if="state == 2" style="margin-top: 25px">诊断时间:{{ timedate }}</div>-->
  181. </div>
  182. <el-dialog title="设置" :visible.sync="dialogVisible" width="30%">
  183. <span style="font-size: 17px">请选择药品是否要通过药房管理出库</span>
  184. <span style="display: block; padding: 18px 25px">
  185. <el-radio v-model="is_open" label="1">是</el-radio>
  186. <el-radio v-model="is_open" label="2">否</el-radio>
  187. </span>
  188. <div style="height: 50px; background: #c7ebfc; border-radius: 5px;padding: 7px;">
  189. <i class="el-icon-info" style="color: #3399ff;font-size: 17px;"></i>
  190. 若选择为是,则通过药房发药的药品都会在发药之后进行出库,否则按原来的方式进行出库管理
  191. </div>
  192. <span slot="footer" class="dialog-footer">
  193. <el-button @click="dialogVisible = false">取 消</el-button>
  194. <el-button type="primary" @click="SaveSetting">保 存</el-button>
  195. </span>
  196. </el-dialog>
  197. </div>
  198. <patient-print
  199. ref="patientprint"
  200. :visibility="isVisibility"
  201. :propsTable="propsTable"
  202. >
  203. </patient-print>
  204. </div>
  205. </template>
  206. <script>
  207. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  208. import patientPrint from "./print/patientPrint.vue";
  209. import { getPharmacyConfig, SaveSetting } from "@/api/his/advice";
  210. import {
  211. waitingdrug,
  212. issueddrugs,
  213. todaynumber,
  214. getpharmacycontent,
  215. dispensingmedicine,
  216. drugwithdrawal,
  217. } from "@/api/pharmacy";
  218. const moment = require("moment");
  219. export default {
  220. components: {
  221. BreadCrumb,
  222. patientPrint,
  223. },
  224. data() {
  225. return {
  226. patient_id: 0,
  227. crumbs: [
  228. { path: false, name: "患者发药" },
  229. { path: "/Pharmacy/patiantDispensing", name: "患者发药" },
  230. ],
  231. tableHeight: 400,
  232. start_time: moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
  233. state: 1, //1待发药,2已发药
  234. waitmount: 0, //待发药人数
  235. waitmount_data: [],
  236. alreadmount: 0, //已发药人数
  237. alreadmount_data: [],
  238. keywords: "",
  239. tableData: [],
  240. propsTable: [],
  241. tableData_list: [],
  242. isVisibility: false,
  243. currentRow: null,
  244. dialogVisible: false,
  245. is_open: "2",
  246. };
  247. },
  248. watch: {},
  249. created() {
  250. this.init();
  251. this.gettodaynumber();
  252. this.fun3();
  253. // this.getwaitmount();//fun3
  254. // this.selectedbydefault();
  255. },
  256. methods: {
  257. tiaoshi() {
  258. console.log("this.tableData", this.tableData);
  259. },
  260. async fun3() {
  261. console.log("fun3");
  262. this.fun1().then((val) => {
  263. this.fun2();
  264. });
  265. },
  266. async fun4(tmp) {
  267. console.log("fun3");
  268. this.fun1().then((val) => {
  269. console.log("this.alreadmount_data", this.alreadmount_data);
  270. for (let i = 0; i < this.alreadmount_data.length; i++) {
  271. console.log("tmp = ", tmp);
  272. if (this.alreadmount_data[i].PatientID == tmp) {
  273. console.log("i = ", i);
  274. this.$refs.table02.setCurrentRow(this.alreadmount_data[i]);
  275. this.handleCurrentChange(this.alreadmount_data[i]);
  276. }
  277. }
  278. });
  279. },
  280. async fun5(tmp) {
  281. console.log("fun3");
  282. this.fun1().then((val) => {
  283. console.log("this.alreadmount_data", this.waitmount_data);
  284. for (let i = 0; i < this.waitmount_data.length; i++) {
  285. console.log("tmp = ", tmp);
  286. if (this.waitmount_data[i].PatientID == tmp) {
  287. console.log("i = ", i);
  288. this.$refs.table02.setCurrentRow(this.waitmount_data[i]);
  289. this.handleCurrentChange(this.waitmount_data[i]);
  290. }
  291. }
  292. });
  293. },
  294. lala() {
  295. console.log("this.state!!!!!!", this.state);
  296. //初始化状态
  297. this.tableData = null;
  298. this.currentRow = null;
  299. this.selectedbydefault();
  300. },
  301. //选中行数
  302. handleCurrentChange(val) {
  303. this.currentRow = val;
  304. console.log("this.currentRow", this.currentRow);
  305. if (this.state == 1) {
  306. this.getpatientdetails(0);
  307. }
  308. if (this.state == 2) {
  309. this.getpatientdetails(1);
  310. }
  311. },
  312. init() {
  313. // console.log("初始化了")
  314. this.state = 1;
  315. this.tableData = null;
  316. this.currentRow = null;
  317. },
  318. testsss() {
  319. this.state = 1;
  320. },
  321. //默认选中的
  322. selectedbydefault() {
  323. if (this.state == 1 && this.waitmount_data.length > 0) {
  324. this.$refs.table01.setCurrentRow(this.waitmount_data[0]);
  325. this.handleCurrentChange(this.waitmount_data[0]);
  326. }
  327. if (this.state == 2 && this.alreadmount_data.length > 0) {
  328. this.$refs.table02.setCurrentRow(this.alreadmount_data[0]);
  329. this.handleCurrentChange(this.alreadmount_data[0]);
  330. }
  331. },
  332. //包装selectedbydefault
  333. fun2() {
  334. console.log("3333333this.waitmount_data", this.waitmount_data);
  335. // return new Promise((resolve, reject) => {
  336. if (this.state == 1 && this.waitmount_data.length > 0) {
  337. this.$refs.table01.setCurrentRow(this.waitmount_data[0]);
  338. this.handleCurrentChange(this.waitmount_data[0]);
  339. }
  340. if (this.state == 2 && this.alreadmount_data.length > 0) {
  341. this.$refs.table02.setCurrentRow(this.alreadmount_data[0]);
  342. this.handleCurrentChange(this.alreadmount_data[0]);
  343. }
  344. // });
  345. },
  346. changeTimes() {
  347. this.gettodaynumber();
  348. this.getwaitmount();
  349. this.fun3();
  350. },
  351. //获取当天发药的人数
  352. gettodaynumber() {
  353. console.log("aaa");
  354. var params = {
  355. time: this.start_time,
  356. };
  357. todaynumber(params).then((res) => {
  358. if (res.data.state == 1) {
  359. this.waitmount = res.data.data.itotal;
  360. this.alreadmount = res.data.data.wtotal;
  361. }
  362. });
  363. // console.log("2222222")
  364. },
  365. //获取发药人列表
  366. getwaitmount() {
  367. var params = {
  368. keyword: this.keywords,
  369. time: this.start_time,
  370. };
  371. waitingdrug(params).then((res) => {
  372. if (res.data.state == 1) {
  373. this.waitmount_data = res.data.data.list;
  374. }
  375. });
  376. issueddrugs(params).then((res) => {
  377. if (res.data.state == 1) {
  378. this.alreadmount_data = res.data.data.list;
  379. }
  380. });
  381. },
  382. //包装getwaitmount
  383. async fun1() {
  384. // return new Promise((resolve, reject) => {
  385. var params = {
  386. keyword: this.keywords,
  387. time: this.start_time,
  388. };
  389. await waitingdrug(params).then((res) => {
  390. if (res.data.state == 1) {
  391. this.waitmount_data = res.data.data.list;
  392. console.log("1111111");
  393. }
  394. });
  395. await issueddrugs(params).then((res) => {
  396. if (res.data.state == 1) {
  397. this.alreadmount_data = res.data.data.list;
  398. console.log("1111111s");
  399. }
  400. });
  401. console.log("222222222");
  402. // })
  403. },
  404. //获取患者信息详情
  405. getpatientdetails(val) {
  406. var params = {
  407. patient_id: this.currentRow.PatientID,
  408. is_medicine: val,
  409. time: this.start_time,
  410. };
  411. getpharmacycontent(params).then((res) => {
  412. if (res.data.state == 1) {
  413. this.tableData = res.data.data.list;
  414. } else {
  415. this.$message.error(res.data.msg);
  416. }
  417. });
  418. },
  419. // 跳转打印页面
  420. toPrint() {
  421. if (this.tableData == null) {
  422. this.$message.error("未选择任何数据");
  423. return;
  424. }
  425. this.$refs.patientprint.show(this.tableData, this.currentRow, this.state);
  426. },
  427. // 搜索患者
  428. searchAction() {},
  429. // 药品发药
  430. dispense() {
  431. var tmp = this.currentRow.PatientID;
  432. var params = {
  433. patient_id: this.currentRow.PatientID,
  434. time: this.start_time,
  435. };
  436. this.$confirm("确定是否对该药品进行发药?", "患者发药", {
  437. confirmButtonText: "确 定",
  438. cancelButtonText: "取 消",
  439. type: "warning",
  440. })
  441. .then(() => {
  442. dispensingmedicine(params).then((res) => {
  443. if (res.data.state == 1) {
  444. this.$message.success("操作成功");
  445. this.gettodaynumber();
  446. this.searchAction();
  447. this.tableData = null;
  448. this.fun4(tmp);
  449. this.state = 2;
  450. // console.log("this.alreadmount_data",this.alreadmount_data)
  451. // for (let i = 0;i < this.alreadmount_data.length;i++){
  452. // console.log("tmp = ",tmp)
  453. // if (this.alreadmount_data[i].PatientID == tmp){
  454. // console.log("i = ",i)
  455. // this.$refs.table02.setCurrentRow(this.alreadmount_data[i]);
  456. // this.handleCurrentChange(this.alreadmount_data[i])
  457. // }
  458. // }
  459. } else {
  460. this.$message.error(res.data.msg);
  461. }
  462. });
  463. })
  464. .catch(() => {});
  465. },
  466. toSetting() {
  467. getPharmacyConfig().then((response) => {
  468. if (response.data.state == 1) {
  469. this.dialogVisible = true;
  470. var config = response.data.data.config;
  471. this.is_open = config.is_open.toString();
  472. }
  473. });
  474. },
  475. SaveSetting() {
  476. var params = {
  477. is_open: parseInt(this.is_open),
  478. };
  479. SaveSetting(params).then((response) => {
  480. if (response.data.state == 1) {
  481. var config = response.data.data.config;
  482. this.$message.success("保存成功!");
  483. this.dialogVisible = false;
  484. }
  485. });
  486. },
  487. // 药品退药
  488. endispense() {
  489. var tmp = this.currentRow.PatientID;
  490. var params = {
  491. patient_id: this.currentRow.PatientID,
  492. time: this.start_time,
  493. };
  494. this.$confirm("确定是否对该药品进行退药?", "患者退药", {
  495. confirmButtonText: "确 定",
  496. cancelButtonText: "取 消",
  497. type: "warning",
  498. })
  499. .then(() => {
  500. drugwithdrawal(params).then((res) => {
  501. if (res.data.state == 1) {
  502. this.$message.success("操作成功");
  503. this.gettodaynumber();
  504. this.searchAction();
  505. this.tableData = null;
  506. this.fun4(tmp);
  507. this.state = 1;
  508. } else {
  509. this.$message.error(res.data.msg);
  510. }
  511. });
  512. })
  513. .catch(() => {});
  514. },
  515. },
  516. };
  517. </script>
  518. <style rel="stylesheet/css" lang="scss" scoped>
  519. .new-main-contain {
  520. height: 100%;
  521. display: flex;
  522. flex-direction: column;
  523. }
  524. .app-container {
  525. height: 100%;
  526. }
  527. .mainLeft {
  528. width: 200px;
  529. height: 100%;
  530. display: flex;
  531. flex-direction: column;
  532. .el-radio {
  533. margin-right: 5px;
  534. }
  535. .list {
  536. margin: 10px 0;
  537. }
  538. }
  539. .mainRight {
  540. margin-left: 10px;
  541. flex: 1;
  542. height: 100%;
  543. display: flex;
  544. flex-direction: column;
  545. overflow-y: auto;
  546. .titlelist {
  547. display: flex;
  548. justify-content: flex-end;
  549. }
  550. }
  551. /deep/ .el-table--scrollable-x .el-table__body-wrapper {
  552. overflow: auto;
  553. }
  554. /deep/ .gutter {
  555. width: 15px !important;
  556. display: inline-block !important;
  557. }
  558. /deep/ .el-table__fixed-right-patch {
  559. width: 15px !important;
  560. }
  561. /deep/ .el-table__fixed-right {
  562. bottom: 0 !important;
  563. left: auto;
  564. right: 0;
  565. }
  566. /deep/ .el-table__body-wrapper::-webkit-scrollbar {
  567. width: 15px !important;
  568. height: 15px !important;
  569. }
  570. </style>