DrugDispensing.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <template><!--药品发药页面-->
  2. <div class="main-contain new-main-contain">
  3. <div class="position">
  4. <!-- <bread-crumb :crumbs='crumbs'></bread-crumb>-->
  5. <bread-crumb :crumbs="crumbs"></bread-crumb>
  6. </div>
  7. <div
  8. class="app-container"
  9. style="display: flex; flex: 1; padding: 10px 20px 0px 20px"
  10. >
  11. <div class="mainLeft">
  12. <div>
  13. <div class="list">
  14. <el-date-picker
  15. style="width: 300px"
  16. v-model="start_time"
  17. type="date"
  18. format="yyyy-MM-dd"
  19. value-format="yyyy-MM-dd"
  20. placeholder="选择日期"
  21. :change="testsss()"
  22. >
  23. </el-date-picker>
  24. </div>
  25. <div class="list">
  26. <el-radio-group v-model="state">
  27. <el-radio :label="1">待发药</el-radio>
  28. <el-radio :label="2">已发药</el-radio>
  29. </el-radio-group>
  30. </div>
  31. <div class="list">
  32. <el-input
  33. size="small"
  34. style="width: 239px"
  35. v-model="keywords"
  36. class="filter-item"
  37. placeholder="请输入药品名称"
  38. />
  39. <el-button
  40. size="small"
  41. class="filter-item"
  42. type="primary"
  43. @click="searchAction"
  44. >搜索
  45. </el-button>
  46. </div>
  47. <el-table
  48. v-if="state == 1"
  49. :height="tableHeight"
  50. :data="tableData"
  51. border
  52. style="width: 100%"
  53. highlight-current-row
  54. ref="singleTable"
  55. @current-change="handleCurrentChange"
  56. >
  57. <el-table-column prop="name" label="名称" width="100">
  58. <template slot-scope="scope">
  59. {{scope.row.drug_name}}
  60. </template>
  61. </el-table-column>
  62. <el-table-column prop="specifications" label="规格" width="100">
  63. <template slot-scope="scope">
  64. {{scope.row.dose}}{{scope.row.dose_unit}}*{{scope.row.min_number}}{{scope.row.min_unit}}/{{scope.row.max_unit}}
  65. </template>
  66. </el-table-column>
  67. <el-table-column prop="stock" label="库存" width="100">
  68. <template slot-scope="scope">
  69. {{getWarehoseInfo(scope.row.drug_warehouse_info,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
  70. </template>
  71. </el-table-column>
  72. </el-table>
  73. <el-table
  74. v-if="state == 2"
  75. :height="tableHeight"
  76. :data="tableData"
  77. border
  78. style="width: 100%"
  79. highlight-current-row
  80. @current-change="handleSelectionChangeOne"
  81. ref="singleTable"
  82. >
  83. <el-table-column prop="name" label="名称" width="100">
  84. <template slot-scope="scope">
  85. {{scope.row.drug_name}}
  86. </template>
  87. </el-table-column>
  88. <el-table-column prop="specifications" label="规格" width="100">
  89. <template slot-scope="scope">
  90. {{scope.row.dose}}{{scope.row.dose_unit}}*{{scope.row.min_number}}{{scope.row.min_unit}}/{{scope.row.max_unit}}
  91. </template>
  92. </el-table-column>
  93. <el-table-column prop="stock" label="库存" width="100">
  94. <template slot-scope="scope">
  95. {{getWarehoseInfo(scope.row.drug_warehouse_info,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. </div>
  100. </div>
  101. <div class="mainRight">
  102. <div class="titlelist">
  103. <el-button type="primary" @click="dispense" v-if="state == 1">发药</el-button>
  104. <el-button type="primary" @click="toPrint">打印</el-button>
  105. <el-button type="primary" @click="toSetting">设置</el-button>
  106. </div>
  107. <el-divider></el-divider>
  108. <div>
  109. <el-table
  110. :height="tableHeight"
  111. :data="tableData_list"
  112. border
  113. style="width: 1328px"
  114. @selection-change="handleSelectionChange"
  115. v-if="state == 1"
  116. >
  117. >
  118. <el-table-column type="selection" width="55"> </el-table-column>
  119. <el-table-column type="index" label="序号" width="120" align="center">
  120. <template slot-scope="scope">
  121. {{scope.$index + 1}}
  122. </template>
  123. </el-table-column>
  124. <el-table-column prop="name" label="患者名称" width="180" align="center">
  125. <template slot-scope="scope">
  126. {{getPatientName(scope.row.patient_id)}}
  127. </template>
  128. </el-table-column>
  129. <el-table-column prop="name" label="单次用量" width="170" align="center">
  130. <template slot-scope="scope">
  131. {{scope.row.single_dose}}
  132. </template>
  133. </el-table-column>
  134. <el-table-column prop="name" label="用法" width="160" align="center">
  135. <template slot-scope="scope">
  136. {{scope.row.delivery_way}}
  137. </template>
  138. </el-table-column>
  139. <el-table-column prop="name" label="频率" width="160" align="center">
  140. <template slot-scope="scope">
  141. {{scope.row.execution_frequency}}
  142. </template>
  143. </el-table-column>
  144. <el-table-column prop="name" label="天数" width="160" align="center">
  145. <template slot-scope="scope">
  146. {{scope.row.day}}
  147. </template>
  148. </el-table-column>
  149. <el-table-column prop="name" label="总量" width="160" align="center">
  150. <template slot-scope="scope">
  151. {{scope.row.prescribing_number}}
  152. </template>
  153. </el-table-column>
  154. <el-table-column prop="name" label="数据来源" width="162" align="center">
  155. <template slot-scope="scope">
  156. <span v-if="scope.row.type == 1">血透</span>
  157. <span v-if="scope.row.type == 2">HIS</span>
  158. </template>
  159. </el-table-column>
  160. </el-table>
  161. <el-table
  162. :height="tableHeight"
  163. :data="tableList"
  164. border
  165. style="width: 1328px"
  166. v-if="state == 2"
  167. >
  168. >
  169. <el-table-column type="selection" width="55"> </el-table-column>
  170. <el-table-column type="index" label="序号" width="120" align="center">
  171. <template slot-scope="scope">
  172. {{scope.$index + 1}}
  173. </template>
  174. </el-table-column>
  175. <el-table-column prop="name" label="患者名称" width="180" align="center">
  176. <template slot-scope="scope">
  177. {{getPatientName(scope.row.patient_id)}}
  178. </template>
  179. </el-table-column>
  180. <el-table-column prop="name" label="单次用量" width="170" align="center">
  181. <template slot-scope="scope">
  182. {{scope.row.single_dose}}
  183. </template>
  184. </el-table-column>
  185. <el-table-column prop="name" label="用法" width="160" align="center">
  186. <template slot-scope="scope">
  187. {{scope.row.delivery_way}}
  188. </template>
  189. </el-table-column>
  190. <el-table-column prop="name" label="频率" width="160" align="center">
  191. <template slot-scope="scope">
  192. {{scope.row.execution_frequency}}
  193. </template>
  194. </el-table-column>
  195. <el-table-column prop="name" label="天数" width="160" align="center">
  196. <template slot-scope="scope">
  197. {{scope.row.day}}
  198. </template>
  199. </el-table-column>
  200. <el-table-column prop="name" label="总量" width="160" align="center">
  201. <template slot-scope="scope">
  202. {{scope.row.prescribing_number}}
  203. </template>
  204. </el-table-column>
  205. <el-table-column prop="name" label="数据来源" width="162" align="center">
  206. <template slot-scope="scope">
  207. <span v-if="scope.row.type == 1">血透</span>
  208. <span v-if="scope.row.type == 2">HIS</span>
  209. </template>
  210. </el-table-column>
  211. </el-table>
  212. </div>
  213. <div style="margin-top">领料人:
  214. <el-select v-model="admin_user_id" placeholder="请选择">
  215. <el-option
  216. v-for="item in doctorList"
  217. :key="item.admin_user_id"
  218. :label="item.user_name"
  219. :value="item.admin_user_id">
  220. </el-option>
  221. </el-select>
  222. </div>
  223. </div>
  224. <el-dialog
  225. title="设置"
  226. :visible.sync="dialogVisible"
  227. width="30%">
  228. <span>请选择药品是否要通过药房管理出库</span>
  229. <span>
  230. <el-radio v-model="is_open" label="1">是</el-radio>
  231. <el-radio v-model="is_open" label="2">否</el-radio>
  232. </span>
  233. <span>
  234. 若选择为是,则通过药房发药的药品都会在发药之后进行出库,否则按原来的方式进行出库管理
  235. </span>
  236. <span slot="footer" class="dialog-footer">
  237. <el-button @click="dialogVisible = false">取 消</el-button>
  238. <el-button type="primary" @click="SaveSetting">确 定</el-button>
  239. </span>
  240. </el-dialog>
  241. </div>
  242. <drug-print
  243. ref="drugprint"
  244. :visibility="isVisibility"
  245. :propsTable="propsTable"
  246. :state="state"
  247. >
  248. </drug-print>
  249. </div>
  250. </template>
  251. <script>
  252. import drugPrint from "./print/drugPrint.vue";
  253. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  254. import { getTodayAdviceList,getPharmacyBaseDrug,updatePharmacyBaseDrug,SaveSetting,getPharmacyConfig,getUserdDrugList } from "@/api/his/advice";
  255. // import {
  256. // waitingdrug,
  257. // issueddrugs,
  258. // getpharmacycontent
  259. // } from "@/api/pharmacy"
  260. const moment = require('moment')
  261. export default {
  262. components: {
  263. BreadCrumb,
  264. drugPrint,
  265. },
  266. data() {
  267. return {
  268. crumbs: [
  269. { path: false, name: "药品发药" },
  270. { path: "/Pharmacy/DrugDispensing", name: "药品发药" },
  271. ],
  272. tableHeight: 400,
  273. datepick: "",
  274. state: 1,
  275. waitmount: 0,
  276. alreadmount: 0,
  277. tableData: [],
  278. tableData_list: [],
  279. tableList:[],
  280. multipleSelection: [],
  281. start_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
  282. patientList:[],
  283. keywords:"",
  284. dialogVisible:false,
  285. is_open:"2",
  286. isVisibility:"",
  287. propsTable:"",
  288. doctorList:[],
  289. admin_user_id:this.$store.getters.xt_user.user.id,
  290. };
  291. },
  292. methods: {
  293. testsss(){
  294. console.log("time",this.start_time);
  295. },
  296. //初始化
  297. init(){
  298. },
  299. searchAction() {
  300. this.getlist();
  301. },
  302. // 跳转打印页面
  303. toPrint() {
  304. // this.$router.push({ path: "/Pharmacy/print/patientPrint" });
  305. this.$refs.drugprint.show();
  306. },
  307. handleSelectionChange(val) {
  308. this.multipleSelection = val;
  309. },
  310. handleSelectionChangeOne(val){
  311. this.tableList = []
  312. this.getUserlist(val.id)
  313. },
  314. // 药品发药
  315. dispense() {
  316. var blood_ids = []
  317. var his_ids = []
  318. var bloodStr = ""
  319. var hisStr = ""
  320. for(let i=0;i<this.tableData.length;i++){
  321. if(this.tableData[i].type == 1){
  322. blood_ids.push(this.tableData[i].id)
  323. }
  324. if(this.tableData[i].type == 2){
  325. his_ids.push(this.tableData[i].id)
  326. }
  327. }
  328. bloodStr = blood_ids.join(",")
  329. hisStr = his_ids.join(",")
  330. var params = {
  331. bloodStr:bloodStr,
  332. hisStr:hisStr,
  333. admin_user_id:this.admin_user_id,
  334. }
  335. this.$confirm("确定是否对该药品进行发药?", "患者发药", {
  336. confirmButtonText: "确 定",
  337. cancelButtonText: "取 消",
  338. type: "warning",
  339. }).then(() => {
  340. updatePharmacyBaseDrug(params).then(response=>{
  341. if(response.data.state == 1){
  342. var msg = response.data.data.msg
  343. var medical = response.data.data.medical
  344. if(msg === 1){
  345. this.$message.success("发药成功!")
  346. }
  347. if(msg == 2 || msg ===3){
  348. this.$message.error("库存不足")
  349. }
  350. }
  351. })
  352. }).catch(() => {});
  353. },
  354. // 药品退药
  355. endispense() {
  356. var params = {};
  357. this.$confirm("确定是否对该药品进行退药?", "患者退药", {
  358. confirmButtonText: "确 定",
  359. cancelButtonText: "取 消",
  360. type: "warning",
  361. })
  362. .then(() => {})
  363. .catch(() => {});
  364. },
  365. getlist(){
  366. var params = {
  367. start_time:this.start_time,
  368. keywords:this.keywords,
  369. }
  370. getTodayAdviceList(params).then(response=>{
  371. if(response.data.state == 1){
  372. var list = response.data.data.list
  373. this.$refs.singleTable.setCurrentRow(list[0])
  374. this.tableData = list
  375. var doctorlist = response.data.data.doctorlist
  376. this.doctorList = doctorlist
  377. }
  378. })
  379. },
  380. getWarehoseInfo(arr, max_unit, min_unit, min_number) {
  381. var total = 0;
  382. var max_str = "";
  383. var min_str = "";
  384. if (arr.length > 0) {
  385. for (let i = 0; i < arr.length; i++) {
  386. total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
  387. }
  388. }
  389. if (total < min_number) {
  390. min_str = total + min_unit;
  391. }
  392. if (total == 0) {
  393. min_str = "";
  394. max_str = "";
  395. }
  396. if (total >= min_number) {
  397. if (parseInt(total / min_number) != 0) {
  398. max_str = parseInt(total / min_number) + max_unit;
  399. }
  400. if (total % min_number != 0) {
  401. min_str = (total % min_number) + min_unit;
  402. }
  403. }
  404. return max_str + min_str;
  405. },
  406. handleCurrentChange(row) {
  407. this.getPharmacyBaseDrug(row.id)
  408. },
  409. getPharmacyBaseDrug(drug_id){
  410. var params = {
  411. start_time:this.start_time,
  412. drug_id:drug_id,
  413. }
  414. getPharmacyBaseDrug(params).then(response=>{
  415. if(response.data.state == 1){
  416. var advicelist = response.data.data.advicelist
  417. for(let i=0;i<advicelist.length;i++){
  418. advicelist[i].type = 1
  419. advicelist[i].day = " "
  420. this.tableData_list.push(advicelist[i])
  421. }
  422. var hisAdviceList = response.data.data.hisAdviceList
  423. for(let i=0;i<hisAdviceList.length;i++){
  424. hisAdviceList[i].type = 2
  425. this.tableData_list.push(hisAdviceList[i])
  426. }
  427. var patient = response.data.data.patient
  428. this.patientList = patient
  429. }
  430. })
  431. },
  432. getPatientName(id){
  433. var name = ""
  434. for(let i=0;i<this.patientList.length;i++){
  435. if(id == this.patientList[i].id){
  436. name = this.patientList[i].name
  437. }
  438. }
  439. return name
  440. },
  441. toSetting(){
  442. getPharmacyConfig().then(response=>{
  443. if(response.data.state == 1){
  444. this.dialogVisible = true
  445. var config = response.data.data.config
  446. this.is_open = config.is_open.toString()
  447. }
  448. })
  449. },
  450. SaveSetting(){
  451. var params = {
  452. is_open:parseInt(this.is_open),
  453. }
  454. SaveSetting(params).then(response=>{
  455. if(response.data.state == 1){
  456. var config = response.data.data.config
  457. this.$message.success("保存成功!")
  458. this.dialogVisible = false
  459. }
  460. })
  461. },
  462. getUserlist(drug_id){
  463. var params = {
  464. start_time:this.start_time,
  465. drug_id:drug_id,
  466. }
  467. getUserdDrugList(params).then(response=>{
  468. if(response.data.state == 1){
  469. var advicelist = response.data.data.advicelist
  470. for(let i=0;i<advicelist.length;i++){
  471. advicelist[i].type = 1
  472. advicelist[i].day = " "
  473. this.tableList.push(advicelist[i])
  474. }
  475. var hisAdviceList = response.data.data.hisAdviceList
  476. for(let i=0;i<hisAdviceList.length;i++){
  477. hisAdviceList[i].type = 2
  478. this.tableList.push(hisAdviceList[i])
  479. }
  480. var patient = response.data.data.patient
  481. this.patientList = patient
  482. }
  483. })
  484. }
  485. },
  486. created() {
  487. this.init();
  488. this.getlist()
  489. },
  490. };
  491. </script>
  492. <style rel="stylesheet/css" lang="scss" scoped>
  493. .new-main-contain {
  494. height: 100%;
  495. display: flex;
  496. flex-direction: column;
  497. }
  498. .app-container {
  499. height: 100%;
  500. }
  501. .mainLeft {
  502. width: 300px;
  503. height: 100%;
  504. display: flex;
  505. flex-direction: column;
  506. .el-radio {
  507. margin-right: 75px;
  508. }
  509. .list {
  510. margin: 10px 0;
  511. }
  512. }
  513. .mainRight {
  514. margin-left: 10px;
  515. flex: 1;
  516. height: 100%;
  517. display: flex;
  518. flex-direction: column;
  519. overflow-y: auto;
  520. .titlelist {
  521. display: flex;
  522. justify-content: flex-end;
  523. }
  524. }
  525. </style>