PatientDispensing.vue 48KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594
  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="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. <!-- <el-button @click="testsss">调试1</el-button>-->
  27. <!-- <el-button @click="testsss2">调试2</el-button>-->
  28. <div class="list">
  29. <el-radio-group v-model="state" @change="lala()">
  30. <el-radio :label="1">待发药{{ waitmount }}人</el-radio>
  31. <el-radio :label="2">已发药{{ alreadmount }}人</el-radio>
  32. </el-radio-group>
  33. </div>
  34. <div
  35. class="list"
  36. style="display: flex; justify-content: space-between"
  37. >
  38. <el-input
  39. size="small"
  40. style="width: 130px"
  41. v-model="keywords"
  42. class="filter-item"
  43. placeholder="请输入患者名称"
  44. clearable
  45. />
  46. <el-button
  47. size="small"
  48. class="filter-item"
  49. type="primary"
  50. @click="searchAction"
  51. >搜索
  52. </el-button>
  53. </div>
  54. <el-table
  55. height="60vh"
  56. ref="table01"
  57. :data="waitmount_data"
  58. highlight-current-row
  59. @current-change="handleCurrentChange"
  60. border
  61. style="width: 100%"
  62. v-if="state == 1"
  63. :row-style="{ color: '#303133' }"
  64. :header-cell-style="{
  65. backgroundColor: 'rgb(245, 247, 250)',
  66. color: '#606266',
  67. }"
  68. >
  69. <el-table-column prop="date" label="患者姓名" width="100">
  70. <template slot-scope="scope">
  71. <span>{{ scope.row.name ? scope.row.name : "" }}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column prop="name" label="透析号" width="100">
  75. <template slot-scope="scope">
  76. <span>{{
  77. scope.row.dialysis_no ? scope.row.dialysis_no : ""
  78. }}</span>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <el-table
  83. :height="tableHeight"
  84. ref="table02"
  85. :data="alreadmount_data"
  86. highlight-current-row
  87. @current-change="handleCurrentChange"
  88. border
  89. :row-style="{ color: '#303133' }"
  90. :header-cell-style="{
  91. backgroundColor: 'rgb(245, 247, 250)',
  92. color: '#606266',
  93. }"
  94. style="width: 100%"
  95. v-if="state == 2"
  96. >
  97. <el-table-column prop="date" label="患者姓名" width="100">
  98. <template slot-scope="scope">
  99. <span>{{ scope.row.name ? scope.row.name : "" }}</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column prop="name" label="透析号" width="100">
  103. <template slot-scope="scope">
  104. <span>{{
  105. scope.row.dialysis_no ? scope.row.dialysis_no : ""
  106. }}</span>
  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="searchAction"
  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="searchAction"
  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. </div>
  144. <div>
  145. <el-button type="primary" @click="toExport" v-if="state == 2"
  146. >导出</el-button
  147. >
  148. <el-button type="primary" @click="dispense" v-if="state == 1"
  149. >发药</el-button
  150. >
  151. <el-button type="primary" @click="endispense" v-if="state == 2"
  152. >退药</el-button
  153. >
  154. <el-button type="primary" @click="toPrint" v-if="printShow">打印</el-button>
  155. <!-- <el-button @click="tiaoshi">调试</el-button>-->
  156. <el-button type="primary" v-if="state == 1" @click="toSetting"
  157. >设置</el-button
  158. >
  159. </div>
  160. </div>
  161. <el-divider style="margin-top: 10px"></el-divider>
  162. <div>
  163. <el-table
  164. :height="tableHeight"
  165. :data="tableData"
  166. border
  167. style="width: 100%"
  168. :row-style="{ color: '#303133' }"
  169. :header-cell-style="{
  170. backgroundColor: 'rgb(245, 247, 250)',
  171. color: '#606266',
  172. }"
  173. >
  174. <el-table-column
  175. type="index"
  176. label="序号"
  177. width="50"
  178. align="center"
  179. >
  180. </el-table-column>
  181. <el-table-column label="名称" width="100" align="center">
  182. <template slot-scope="scope">
  183. <span>{{ scope.row.Name ? scope.row.Name : "" }}</span>
  184. </template>
  185. </el-table-column>
  186. <el-table-column label="规格" width="100" align="center">
  187. <template slot-scope="scope">
  188. <span>{{ scope.row.Spec}}</span>
  189. </template>
  190. </el-table-column>
  191. <el-table-column label="单次用量" width="100" align="center">
  192. <template slot-scope="scope">
  193. <span>{{
  194. scope.row.SingleDosage ? scope.row.SingleDosage : ""
  195. }}</span>
  196. </template>
  197. </el-table-column>
  198. <el-table-column label="用法" width="100" align="center">
  199. <template slot-scope="scope">
  200. <span>{{ scope.row.Usage ? scope.row.Usage : "" }}</span>
  201. </template>
  202. </el-table-column>
  203. <el-table-column label="频率" width="100" align="center">
  204. <template slot-scope="scope">
  205. <span>{{
  206. scope.row.Frequency ? scope.row.Frequency : ""
  207. }}</span>
  208. </template>
  209. </el-table-column>
  210. <el-table-column label="天数" width="100" align="center">
  211. <template slot-scope="scope">
  212. <span>{{ scope.row.Days ? scope.row.Days : "" }}</span>
  213. </template>
  214. </el-table-column>
  215. <el-table-column label="总量" width="100" align="center">
  216. <template slot-scope="scope">
  217. <span>{{ scope.row.Total ? scope.row.Total : "" }}</span>
  218. </template>
  219. </el-table-column>
  220. <el-table-column label="生产厂商" width="100" align="center">
  221. <template slot-scope="scope">
  222. <span>{{ (scope.row.MName) }}</span>
  223. </template>
  224. </el-table-column>
  225. <el-table-column label="药品追溯码" width="162" align="center">
  226. <template slot-scope="scope">
  227. <div @click="getDrugCode(scope.row.ID,scope.row.DataSources,scope.row.DrugCode,scope.$index,scope.row.DrugId,scope.row.Type)"><el-input style="width: 100;" v-model="scope.row.DrugCode"></el-input></div>
  228. </template>
  229. </el-table-column>
  230. <el-table-column label="开立医生" width="150" align="center">
  231. <template slot-scope="scope">
  232. <span>{{ scope.row.Doctor ? scope.row.Doctor : "" }}</span>
  233. </template>
  234. </el-table-column>
  235. <el-table-column label="数据来源" width="162" align="center">
  236. <template slot-scope="scope">
  237. <span>{{
  238. scope.row.DataSources ? scope.row.DataSources : ""
  239. }}</span>
  240. </template>
  241. </el-table-column>
  242. <el-table-column label="国家编码" width="162" align="center">
  243. <template slot-scope="scope">
  244. <span>{{ scope.row.Bm}}</span>
  245. </template>
  246. </el-table-column>
  247. <el-table-column align="center" width="100" label="拆零标志">
  248. <template slot-scope="scope">
  249. <el-select v-model="scope.row.ZeroFlag" placeholder="请选择" @change="changevalue(scope.row)">
  250. <el-option label="未知" value="0"></el-option>
  251. <el-option label="是" value="1"></el-option>
  252. <el-option label="否" value="2"></el-option>
  253. </el-select>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="备注" width="170" align="center">
  257. <template slot-scope="scope">
  258. <span>{{ scope.row.Remarks ? scope.row.Remarks : "" }}</span>
  259. </template>
  260. </el-table-column>
  261. </el-table>
  262. </div>
  263. <!-- <div v-if="state == 2" style="margin-top: 25px">诊断时间:{{ timedate }}</div>-->
  264. </div>
  265. <el-dialog title="设置" :visible.sync="dialogVisible" width="30%">
  266. <span style="font-size: 17px">请选择药品是否要通过药房管理出库</span>
  267. <span style="display: block; padding: 18px 25px">
  268. <el-radio v-model="is_open" label="1">是</el-radio>
  269. <el-radio v-model="is_open" label="2">否</el-radio>
  270. </span>
  271. <span style="font-size: 17px">请选择是否发药时上传追溯码</span>
  272. <span style="display: block; padding: 18px 25px">
  273. <el-radio v-model="is_drug_open" label="1">是</el-radio>
  274. <el-radio v-model="is_drug_open" label="2">否</el-radio>
  275. </span>
  276. <div
  277. style="
  278. height: 50px;
  279. background: #c7ebfc;
  280. border-radius: 5px;
  281. padding: 7px;
  282. "
  283. >
  284. <i class="el-icon-info" style="color: #3399ff; font-size: 17px"></i>
  285. 若选择为是,则通过药房发药的药品都会在发药之后进行出库,否则按原来的方式进行出库管理
  286. </div>
  287. <span slot="footer" class="dialog-footer">
  288. <el-button @click="dialogVisible = false">取 消</el-button>
  289. <el-button type="primary" @click="SaveSetting">保 存</el-button>
  290. </span>
  291. </el-dialog>
  292. <el-dialog
  293. title="药品追溯码"
  294. @open="openDialog"
  295. :visible.sync="dialogVisibleOne"
  296. width="40%">
  297. <span>
  298. <div style="margin-bottom: 10px;">
  299. <span >追溯码个数:{{getTotal() }} 个</span>
  300. </div>
  301. <el-input
  302. ref="inputRef"
  303. @keyup.native="changeText"
  304. type="textarea"
  305. placeholder="请输入内容"
  306. v-model="textarea"
  307. autofocus
  308. :rows="10"
  309. >
  310. </el-input>
  311. </span>
  312. <span slot="footer" class="dialog-footer">
  313. <el-button @click="dialogVisibleOne = false">取 消</el-button>
  314. <el-button type="primary" @click="saveTextArea()">确 定</el-button>
  315. </span>
  316. </el-dialog>
  317. </div>
  318. <patient-print
  319. ref="patientprint"
  320. :visibility="isVisibility"
  321. :propsTable="propsTable"
  322. >
  323. </patient-print>
  324. <patientPrintTwo ref="patientprintTwo"
  325. :visibility="isVisibilityTwo"
  326. :propsTable="propsTable"
  327. >
  328. </patientPrintTwo>
  329. </div>
  330. </template>
  331. <script>
  332. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  333. import patientPrint from "./print/patientPrint.vue";
  334. import patientPrintTwo from './print/patientPrintTwo'
  335. import { getPharmacyConfig, SaveSetting } from "@/api/his/advice";
  336. import {
  337. waitingdrug,
  338. issueddrugs,
  339. todaynumber,
  340. getpharmacycontent,
  341. dispensingmedicine,
  342. drugwithdrawal,
  343. getpartitionlist,
  344. changeDrugCode,
  345. changeZeroFlag,
  346. getDrugTocalCount
  347. } from "@/api/pharmacy";
  348. import dataDruguse from "../../router/modules/dataDruguse";
  349. import axios from 'axios'
  350. const moment = require("moment");
  351. export default {
  352. components: {
  353. BreadCrumb,
  354. patientPrint,
  355. patientPrintTwo
  356. },
  357. data() {
  358. return {
  359. patient_id: 0,
  360. crumbs: [
  361. { path: false, name: "药房管理" },
  362. { path: "/Pharmacy/patiantDispensing", name: "患者发药" },
  363. ],
  364. tableHeight: 400,
  365. start_time: moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
  366. start_time2: moment(new Date()).add("year", 0).format("YYYY-MM-DD HH:mm"),
  367. state: 1, //1待发药,2已发药
  368. waitmount: 0, //待发药人数
  369. waitmount_data: [],
  370. alreadmount: 0, //已发药人数
  371. alreadmount_data: [],
  372. keywords: "",
  373. tableData: [],
  374. propsTable: [],
  375. tableData_list: [],
  376. isVisibility: false,
  377. isVisibilityTwo:false,
  378. currentRow: null,
  379. dialogVisible: false,
  380. is_open: "2",
  381. banshift: [
  382. { value: 0, text: "全部班" },
  383. { value: 1, text: "上午" },
  384. { value: 2, text: "下午" },
  385. { value: 3, text: "晚上" },
  386. ],
  387. shift: 0, //班次
  388. fen: [],
  389. partition: 0, //分区
  390. drugList:[],
  391. baseList:[],
  392. org_id:'',
  393. patients:{},
  394. doctors:[],
  395. diagnosearr:[],
  396. diagnosis:'',
  397. dialogVisibleOne:false,
  398. textarea:"",
  399. id:0,
  400. is_source:0,
  401. drug_code:0,
  402. currentRow:{},
  403. currentIndex:0,
  404. is_drug_open:"2",
  405. textarea:"",
  406. patientList:[],
  407. drug_id:0,
  408. total_count:0,
  409. newArrList:[],
  410. textAreaList:[],
  411. scan_code:"",
  412. printShow:false,
  413. drug_type:1, //1是药品,2耗材
  414. };
  415. },
  416. created() {
  417. this.init();
  418. this.getgetpartitionlist();
  419. this.fun3();
  420. this.org_id = this.$store.getters.xt_user.org.id
  421. },
  422. methods: {
  423. getTotal(){
  424. if(this.textarea!=null){
  425. var textAreaList = this.textarea.split(",")
  426. console.log("textArrleti",textAreaList)
  427. var arr = []
  428. if(textAreaList!=null && textAreaList.length>0){
  429. for(let i=0;i<textAreaList.length;i++){
  430. if(textAreaList[i]!=""){
  431. arr.push(textAreaList[i])
  432. }
  433. }
  434. return arr.length
  435. }else{
  436. return ""
  437. }
  438. }
  439. },
  440. openDialog(){
  441. this.$nextTick(() => {
  442. this.$refs.inputRef.focus()
  443. });
  444. },
  445. changevalue(row){
  446. var params = {
  447. id:row.ID,
  448. zero_flag:row.ZeroFlag,
  449. }
  450. changeZeroFlag(params).then(response=>{
  451. if(response.data.state == 1){
  452. this.$message.success("切换成功")
  453. }
  454. })
  455. },
  456. getgetpartitionlist() {
  457. var params = {};
  458. getpartitionlist(params).then((res) => {
  459. if (res.data.state == 1) {
  460. this.fen = res.data.data.list;
  461. this.is_drug_open = res.data.data.config.is_open
  462. }
  463. });
  464. },
  465. tiaoshi() {
  466. console.log("this.shift", this.shift);
  467. console.log("this.partition", this.partition);
  468. console.log("this.waitmount_data", this.waitmount_data);
  469. console.log("this.alreadmount_data", this.alreadmount_data);
  470. console.log("this.waitmount", this.waitmount);
  471. console.log("this.alreadmount", this.alreadmount);
  472. },
  473. async fun3() {
  474. this.fun1().then((val) => {
  475. this.fun2();
  476. });
  477. },
  478. async fun4(tmp) {
  479. console.log("fun3");
  480. this.fun1().then((val) => {
  481. console.log("this.alreadmount_data", this.alreadmount_data);
  482. for (let i = 0; i < this.alreadmount_data.length; i++) {
  483. console.log("tmp = ", tmp);
  484. if (this.alreadmount_data[i].PatientID == tmp) {
  485. console.log("i = ", i);
  486. this.$refs.table02.setCurrentRow(this.alreadmount_data[i]);
  487. this.handleCurrentChange(this.alreadmount_data[i]);
  488. }
  489. }
  490. });
  491. },
  492. async fun5(tmp) {
  493. console.log("fun5555");
  494. this.fun1().then((val) => {
  495. console.log("this.alreadmount_data", this.waitmount_data);
  496. for (let i = 0; i < this.waitmount_data.length; i++) {
  497. console.log("tmp = ", tmp);
  498. if (this.waitmount_data[i].PatientID == tmp) {
  499. console.log("i = ", i);
  500. this.$refs.table01.setCurrentRow(this.waitmount_data[i]);
  501. this.handleCurrentChange(this.waitmount_data[i]);
  502. }
  503. }
  504. });
  505. },
  506. lala() {
  507. console.log("this.state!!!!!!", this.state);
  508. //初始化状态
  509. this.tableData = null;
  510. this.currentRow = null;
  511. this.selectedbydefault();
  512. },
  513. //选中行数
  514. handleCurrentChange(val) {
  515. console.log("state--",this.state)
  516. this.currentRow = val;
  517. console.log("this.currentRow", this.currentRow);
  518. if (this.state == 1) {
  519. this.tableData = []
  520. this.patients = {}
  521. this.printShow = false
  522. this.getpatientdetails(0);
  523. }
  524. if (this.state == 2) {
  525. this.patients = {}
  526. this.tableData = []
  527. this.printShow = false
  528. this.getpatientdetails(1);
  529. }
  530. },
  531. init() {
  532. // console.log("初始化了")
  533. this.state = 1;
  534. this.tableData = null;
  535. this.currentRow = null;
  536. this.partition = 0;
  537. this.shift = 0;
  538. },
  539. testsss() {
  540. this.state = 1;
  541. },
  542. //默认选中的
  543. selectedbydefault() {
  544. if (this.state == 1 && this.waitmount_data.length > 0) {
  545. this.$refs.table01.setCurrentRow(this.waitmount_data[0]);
  546. this.handleCurrentChange(this.waitmount_data[0]);
  547. }
  548. if (this.state == 2 && this.alreadmount_data.length > 0) {
  549. this.$refs.table02.setCurrentRow(this.alreadmount_data[0]);
  550. this.handleCurrentChange(this.alreadmount_data[0]);
  551. }
  552. },
  553. //包装selectedbydefault
  554. fun2() {
  555. if (this.state == 1 && this.waitmount_data.length > 0) {
  556. this.$refs.table01.setCurrentRow(this.waitmount_data[0]);
  557. this.currentRow = this.waitmount_data[0]
  558. this.handleCurrentChange(this.waitmount_data[0]);
  559. console.log(" this.currentRow111")
  560. console.log( this.currentRow)
  561. }
  562. if (this.state == 2 && this.alreadmount_data.length > 0) {
  563. this.$refs.table02.setCurrentRow(this.alreadmount_data[0]);
  564. this.currentRow = this.alreadmount_data[0]
  565. this.handleCurrentChange(this.alreadmount_data[0]);
  566. console.log(" this.currentRow222")
  567. console.log( this.currentRow)
  568. }
  569. // });
  570. },
  571. changeTimes() {
  572. this.gettodaynumber();
  573. // this.getwaitmount();
  574. this.fun3();
  575. },
  576. //获取当天发药的人数
  577. gettodaynumber() {
  578. var params = {
  579. time: this.start_time,
  580. };
  581. todaynumber(params).then((res) => {
  582. if (res.data.state == 1) {
  583. console.log('3333333',res.data.data);
  584. this.waitmount = res.data.data.itotal;
  585. this.alreadmount = res.data.data.wtotal;
  586. this.drugList = res.data.data.drug
  587. this.is_drug_open = res.data.data.config.is_open
  588. }
  589. });
  590. // console.log("2222222")
  591. },
  592. //获取发药人列表
  593. getwaitmount() {
  594. var params = {
  595. keyword: this.keywords,
  596. time: this.start_time,
  597. shift: this.shift,
  598. partition: this.partition,
  599. };
  600. waitingdrug(params).then((res) => {
  601. if (res.data.state == 1) {
  602. this.waitmount_data=[]
  603. var list = res.data.data.list;
  604. if (this.shift != 0 || this.partition != 0) {
  605. if (this.waitmount_data == null) {
  606. this.waitmount = 0;
  607. } else {
  608. this.waitmount = this.waitmount_data.length;
  609. }
  610. }
  611. this.patientList = []
  612. this.patientList = res.data.data.patientList
  613. var listTwo = res.data.data.listTwo
  614. var newArr =[]
  615. if(listTwo!=null && listTwo.length>0){
  616. for(let i=0;i<listTwo.length;i++){
  617. listTwo[i].PatientID = 0
  618. listTwo[i].Name=""
  619. listTwo[i].DialysisNo=""
  620. listTwo[i].PatientID = listTwo[i].patient_id
  621. listTwo[i].Name = listTwo[i].patient.name
  622. listTwo[i].DialysisNo = listTwo[i].patient.dialysis_no
  623. newArr.push(listTwo[i])
  624. }
  625. }
  626. if(list!=null && list.length>0){
  627. for(let i=0;i<list.length;i++){
  628. this.waitmount_data.push(list[i])
  629. }
  630. if(newArr!=null && newArr.length>0){
  631. for(let i=0;i<newArr.length;i++){
  632. this.waitmount_data.push(newArr[i])
  633. }
  634. }
  635. }
  636. if(this.waitmount_data==null){
  637. if(newArr!=null && newArr.length>0){
  638. for(let i=0;i<newArr.length;i++){
  639. this.waitmount_data.push(newArr[i])
  640. }
  641. }
  642. }
  643. if(list==null){
  644. if(newArr!=null && newArr.length>0){
  645. for(let i=0;i<newArr.length;i++){
  646. this.waitmount_data.push(newArr[i])
  647. }
  648. }
  649. }
  650. }
  651. });
  652. issueddrugs(params).then((res) => {
  653. if (res.data.state == 1) {
  654. this.alreadmount_data =[]
  655. var list = res.data.data.list;
  656. var listTwo =res.data.data.listTwo
  657. if (this.shift != 0 || this.partition != 0) {
  658. if (list == null) {
  659. this.alreadmount = 0;
  660. } else {
  661. this.alreadmount = list.length;
  662. }
  663. }
  664. var newArr =[]
  665. if(listTwo!=null && listTwo.length>0){
  666. for(let i=0;i<listTwo.length;i++){
  667. listTwo[i].PatientID = 0
  668. listTwo[i].Name=""
  669. listTwo[i].DialysisNo=""
  670. listTwo[i].PatientID = listTwo[i].patient_id
  671. listTwo[i].Name = listTwo[i].patient.name
  672. listTwo[i].DialysisNo = listTwo[i].patient.dialysis_no
  673. newArr.push(listTwo[i])
  674. }
  675. }
  676. if(list!=null && list.length>0){
  677. for(let i=0;i<list.length;i++){
  678. this.alreadmount_data.push(list[i])
  679. }
  680. if(newArr!=null && newArr.length>0){
  681. for(let i=0;i<newArr.length;i++){
  682. this.alreadmount_data.push(newArr[i])
  683. }
  684. }
  685. }
  686. if(this.waitmount_data==null){
  687. if(newArr!=null && newArr.length>0){
  688. for(let i=0;i<newArr.length;i++){
  689. this.alreadmount_data.push(newArr[i])
  690. }
  691. }
  692. }
  693. if(list==null){
  694. if(newArr!=null && newArr.length>0){
  695. for(let i=0;i<newArr.length;i++){
  696. this.alreadmount_data.push(newArr[i])
  697. }
  698. }
  699. }
  700. }
  701. });
  702. },
  703. //包装getwaitmount
  704. async fun1() {
  705. var params = {
  706. keyword: this.keywords,
  707. time: this.start_time,
  708. shift: this.shift,
  709. partition: this.partition,
  710. };
  711. await waitingdrug(params).then((res) => {
  712. if (res.data.state == 1) {
  713. this.waitmount_data=[]
  714. this.patientList = []
  715. this.patientList = res.data.data.wait_patientList
  716. this.waitmount_data = this.patientList
  717. this.waitmount =this.waitmount_data.length
  718. }
  719. });
  720. await issueddrugs(params).then((res) => {
  721. if (res.data.state == 1) {
  722. this.alreadmount_data = []
  723. this.alreadmount_data = res.data.data.user_patientList
  724. this.alreadmount = this.alreadmount_data.length
  725. }
  726. });
  727. },
  728. getPatientName(patient_id){
  729. var name = ""
  730. for(let i=0;i<this.patientList.length;i++){
  731. if(patient_id == this.patientList[i].id){
  732. name = this.patientList[i].name
  733. }
  734. }
  735. return name
  736. },
  737. getPatientDialysisNo(patient_id){
  738. var dialysis_no = ""
  739. for(let i=0;i<this.patientList.length;i++){
  740. if(patient_id == this.patientList[i].id){
  741. dialysis_no = this.patientList[i].dialysis_no
  742. }
  743. }
  744. return dialysis_no
  745. },
  746. //获取患者信息详情
  747. getpatientdetails(val) {
  748. // const loading = this.$loading({
  749. // lock: true,
  750. // text: "Loading",
  751. // spinner: "el-icon-loading",
  752. // background: "rgba(0, 0, 0, 0.7)",
  753. // });
  754. console.log("val2332323223",this.currentRow)
  755. var params = {
  756. patient_id: this.currentRow.id,
  757. is_medicine: val,
  758. time: this.start_time,
  759. };
  760. getpharmacycontent(params).then((res) => {
  761. if (res.data.state == 1) {
  762. // loading.close()
  763. var list = res.data.data.list;
  764. console.log("hhhhawoowowow",res.data.data)
  765. this.baseList =[]
  766. this.baseList = res.data.data.baseList
  767. this.doctors = res.data.data.doctors
  768. this.diagnosearr = res.data.data.diagnose
  769. this.diagnosis = res.data.data.prescription.diagnosis
  770. const obj={
  771. age:res.data.data.patients.age,
  772. gender: res.data.data.patients.gender,
  773. diagnose:res.data.data.patients.diagnose,
  774. zhixing:res.data.data.patients.created_time
  775. }
  776. this.patients = {}
  777. this.patients =obj
  778. if(this.$store.getters.xt_user.org.id == 10188 || this.$store.getters.xt_user.org.id == 10217 || this.$store.getters.xt_user.org.id == 10387 || this.$store.getters.xt_user.org.id == 0 || this.$store.getters.xt_user.org.id == 10480 ){
  779. this.tableData = []
  780. if(list!=null && list.length >0){
  781. for(let i=0;i<list.length;i++){
  782. if(list[i].DataSources != "临时医嘱"){
  783. this.tableData.push(list[i])
  784. }
  785. }
  786. }
  787. }
  788. if(this.$store.getters.xt_user.org.id != 10188 && this.$store.getters.xt_user.org.id != 10217 && this.$store.getters.xt_user.org.id != 10387 && this.$store.getters.xt_user.org.id != 0 && this.$store.getters.xt_user.org.id != 10480 ){
  789. this.tableData = []
  790. this.tableData = list
  791. }
  792. this.printShow = true
  793. // console.log("tableDatawoowow",this.tableData)
  794. // loading.close()
  795. } else {
  796. this.$message.error(res.data.msg);
  797. }
  798. });
  799. },
  800. // 跳转打印页面
  801. toPrint() {
  802. console.log('10653',this.tableData);
  803. if (this.tableData == null) {
  804. this.$message.error("未选择任何数据");
  805. return;
  806. }else{
  807. if(this.org_id != 10653 && this.org_id !=0){
  808. this.$refs.patientprint.show(
  809. this.tableData,
  810. this.currentRow,
  811. this.state,
  812. this.start_time
  813. );
  814. }else{
  815. this.$refs.patientprintTwo.show(
  816. this.tableData,
  817. this.currentRow,
  818. this.state,
  819. this.start_time,
  820. this.baseList,
  821. this.patients,
  822. this.doctors,
  823. this.diagnosearr,
  824. this.diagnosis,
  825. )
  826. }
  827. }
  828. },
  829. toExport() {
  830. import("@/vendor/Export2Excel").then((excel) => {
  831. for (let i = 0; i < this.tableData.length; i++) {
  832. this.tableData[i].index = i + 1;
  833. this.tableData[i].time = this.start_time;
  834. this.tableData[i].uname = this.currentRow.Name;
  835. }
  836. const tHeader = [
  837. "序号",
  838. "日期",
  839. "患者名称",
  840. "名称",
  841. "单次用量",
  842. "用法",
  843. "频率",
  844. "天数",
  845. "总量",
  846. "开立医生",
  847. "数据来源",
  848. "备注",
  849. ];
  850. const filterVal = [
  851. "index",
  852. "time",
  853. "uname",
  854. "Name",
  855. "SingleDosage",
  856. "Usage",
  857. "Frequency",
  858. "Days",
  859. "Total",
  860. "Doctor",
  861. "DataSources",
  862. "Remarks",
  863. ];
  864. const data = this.formatJson(filterVal, this.tableData);
  865. excel.export_json_to_excel({
  866. header: tHeader,
  867. data,
  868. filename: "领药单",
  869. });
  870. this.downloadLoading = false;
  871. });
  872. },
  873. formatJson(filterVal, jsonData) {
  874. return jsonData.map((v) => filterVal.map((j) => v[j]));
  875. },
  876. // 搜索患者
  877. searchAction() {
  878. this.tableData = null;
  879. this.fun3();
  880. // this.gettodaynumber();
  881. },
  882. // 药品发药
  883. dispense() {
  884. if (this.is_drug_open == 1){
  885. var that= this
  886. axios.get('http://127.0.0.1:9532/test/net',{}).then(function(response) {
  887. if (response.data.state == 0) {
  888. // that.$message.error(response.data.data.msg);
  889. that.$confirm("数据异常,请检查医保程序是否有打开", "提示", {
  890. confirmButtonText: "确 定",
  891. cancelButtonText: "取 消",
  892. type: "warning",
  893. }).then(() => {
  894. })
  895. .catch(() => {});
  896. return false
  897. } else {
  898. var tmp = that.currentRow.PatientID;
  899. console.log(that.currentRow)
  900. var params = {
  901. patient_id: that.currentRow.PatientID,
  902. time: that.start_time,
  903. admin_user_id: that.$store.getters.xt_user.user.id,
  904. };
  905. that.$confirm("确定是否对该患者进行发药?", "患者发药", {
  906. confirmButtonText: "确 定",
  907. cancelButtonText: "取 消",
  908. type: "warning",
  909. }).then(() => {
  910. dispensingmedicine(params).then((res) => {
  911. if (res.data.state == 1) {
  912. that.$message.success("操作成功");
  913. that.gettodaynumber();
  914. that.searchAction();
  915. that.tableData = null;
  916. that.fun4(tmp);
  917. that.state = 2;
  918. //进行追溯码上传
  919. axios.get('http://127.0.0.1:9532/api/changedrug/four', {
  920. params:params
  921. })
  922. .then(function(response) {
  923. if (response.data.state == 0) {
  924. that.$message.error(response.data.msg)
  925. return false
  926. } else {
  927. if (response.data.data.failed_code == -10) {
  928. that.$confirm(response.data.data.msg, '医保错误信息', {
  929. confirmButtonText: '确 定',
  930. type: 'warning'
  931. }).then(() => {
  932. }).catch(() => {
  933. })
  934. } else {
  935. if(response.data.data.msg.length > 0){
  936. that.$confirm(response.data.data.msg, '上传信息', {
  937. confirmButtonText: '确 定',
  938. type: 'warning'
  939. }).then(() => {
  940. }).catch(() => {
  941. })
  942. }
  943. }
  944. }
  945. })
  946. .catch(function(error) {
  947. })
  948. } else {
  949. that.$message.error(res.data.msg);
  950. }
  951. });
  952. })
  953. .catch(() => {});
  954. }
  955. }).catch(function(error) {
  956. that.$confirm("数据异常,请检查医保程序是否有打开", "提示", {
  957. confirmButtonText: "确 定",
  958. cancelButtonText: "取 消",
  959. type: "warning",
  960. }).then(() => {
  961. })
  962. .catch(() => {});
  963. })
  964. }else{
  965. var tmp = this.currentRow.id;
  966. console.log(this.currentRow)
  967. var params = {
  968. patient_id: this.currentRow.id,
  969. time: this.start_time,
  970. };
  971. this.$confirm("确定是否对该患者进行发药?", "患者发药", {
  972. confirmButtonText: "确 定",
  973. cancelButtonText: "取 消",
  974. type: "warning",
  975. }).then(() => {
  976. dispensingmedicine(params).then((res) => {
  977. if (res.data.state == 1) {
  978. this.$message.success("操作成功");
  979. this.gettodaynumber();
  980. this.searchAction();
  981. this.tableData = null;
  982. this.fun4(tmp);
  983. this.state = 2;
  984. } else {
  985. this.$message.error(res.data.msg);
  986. }
  987. });
  988. })
  989. .catch(() => {});
  990. }
  991. },
  992. toSetting() {
  993. getPharmacyConfig().then((response) => {
  994. if (response.data.state == 1) {
  995. this.dialogVisible = true;
  996. var config = response.data.data.config;
  997. this.is_open = config.is_open.toString();
  998. var codeConfig = response.data.data.codeConfig
  999. this.is_drug_open = codeConfig.is_open.toString()
  1000. }
  1001. });
  1002. },
  1003. SaveSetting() {
  1004. var params = {
  1005. is_open: parseInt(this.is_open),
  1006. is_drug_open:parseInt(this.is_drug_open)
  1007. };
  1008. SaveSetting(params).then((response) => {
  1009. if (response.data.state == 1) {
  1010. var config = response.data.data.config;
  1011. this.$message.success("保存成功!");
  1012. this.dialogVisible = false;
  1013. }
  1014. });
  1015. },
  1016. // 药品退药
  1017. endispense() {
  1018. if (this.is_drug_open == 1){
  1019. var that= this
  1020. axios.get('http://127.0.0.1:9532/test/net',{}).then(function(response) {
  1021. if (response.data.state == 0) {
  1022. // that.$message.error(response.data.data.msg);
  1023. that.$confirm("数据异常,请检查医保程序是否有打开", "提示", {
  1024. confirmButtonText: "确 定",
  1025. cancelButtonText: "取 消",
  1026. type: "warning",
  1027. }).then(() => {
  1028. })
  1029. .catch(() => {
  1030. });
  1031. return false
  1032. } else {
  1033. var tmp = that.currentRow.id;
  1034. var params = {
  1035. patient_id: that.currentRow.id,
  1036. admin_user_id: that.$store.getters.xt_user.user.id,
  1037. time: that.start_time,
  1038. };
  1039. that.$confirm("确定是否对该患者进行退药?", "患者退药", {
  1040. confirmButtonText: "确 定",
  1041. cancelButtonText: "取 消",
  1042. type: "warning",
  1043. }).then(() => {
  1044. drugwithdrawal(params).then((res) => {
  1045. if (res.data.state == 1) {
  1046. that.$message.success("操作成功");
  1047. that.gettodaynumber();
  1048. that.searchAction();
  1049. that.tableData = null;
  1050. that.fun5(tmp);
  1051. that.state = 1;
  1052. //进行追溯码上传
  1053. axios.get('http://127.0.0.1:9532/api/delete_xs_bg_two', {
  1054. params:params
  1055. })
  1056. .then(function(response) {
  1057. if (response.data.state == 0) {
  1058. that.$message.error(response.data.msg)
  1059. return false
  1060. } else {
  1061. if (response.data.data.failed_code == -10) {
  1062. that.$confirm(response.data.data.msg, '医保错误信息', {
  1063. confirmButtonText: '确 定',
  1064. type: 'warning'
  1065. }).then(() => {
  1066. }).catch(() => {
  1067. })
  1068. } else {
  1069. if(response.data.data.msg.length > 0){
  1070. that.$confirm(response.data.data.msg, '上传信息', {
  1071. confirmButtonText: '确 定',
  1072. type: 'warning'
  1073. }).then(() => {
  1074. }).catch(() => {
  1075. })
  1076. }
  1077. }
  1078. }
  1079. })
  1080. .catch(function(error) {
  1081. })
  1082. } else {
  1083. that.$message.error(res.data.msg);
  1084. }
  1085. });
  1086. })
  1087. .catch(() => {});
  1088. }
  1089. }).catch(function(error) {
  1090. that.$confirm("数据异常,请检查医保程序是否有打开", "提示", {
  1091. confirmButtonText: "确 定",
  1092. cancelButtonText: "取 消",
  1093. type: "warning",
  1094. }).then(() => {
  1095. })
  1096. .catch(() => {});
  1097. })
  1098. }else{
  1099. var tmp = this.currentRow.id;
  1100. var params = {
  1101. patient_id: this.currentRow.id,
  1102. time: this.start_time,
  1103. };
  1104. this.$confirm("确定是否对该患者进行退药?", "患者退药", {
  1105. confirmButtonText: "确 定",
  1106. cancelButtonText: "取 消",
  1107. type: "warning",
  1108. }).then(() => {
  1109. drugwithdrawal(params).then((res) => {
  1110. if (res.data.state == 1) {
  1111. this.$message.success("操作成功");
  1112. this.gettodaynumber();
  1113. this.searchAction();
  1114. this.tableData = null;
  1115. this.fun5(tmp);
  1116. this.state = 1;
  1117. } else {
  1118. this.$message.error(res.data.msg);
  1119. }
  1120. });
  1121. })
  1122. .catch(() => {});
  1123. }
  1124. },
  1125. getDrugName(drug_id){
  1126. var medical_insurance_number = ""
  1127. for(let i=0;i<this.drugList.length;i++){
  1128. if(drug_id == this.drugList[i].id){
  1129. medical_insurance_number = this.drugList[i].medical_insurance_number
  1130. }
  1131. }
  1132. return medical_insurance_number
  1133. },
  1134. getManutuer(drug_id){
  1135. var manufacturer_name = ""
  1136. for(let i=0;i<this.baseList.length;i++){
  1137. if(drug_id == this.baseList[i].id){
  1138. manufacturer_name = this.baseList[i].manufacturer_name
  1139. }
  1140. }
  1141. return manufacturer_name
  1142. },
  1143. getSpecaiName(drug_id){
  1144. var spc =""
  1145. for(let i=0;i<this.baseList.length;i++){
  1146. if(drug_id == this.baseList[i].id){
  1147. spc = this.baseList[i].dose + this.baseList[i].dose_unit +"*"+this.baseList[i].min_number+this.baseList[i].min_unit+"/"+this.baseList[i].max_unit
  1148. }
  1149. }
  1150. return spc
  1151. },
  1152. getDrugCode(id,DataSources,DrugCode,index,DrugId,type){
  1153. this.drug_type = type
  1154. console.log(type)
  1155. console.log( this.drug_type)
  1156. if (type == 1){
  1157. // 针对百霖
  1158. if(this.$store.getters.xt_user.org.id == 10138 || this.$store.getters.xt_user.org.id == 10278 || this.$store.getters.xt_user.org.id == 10610 || this.$store.getters.xt_user.org.id == 10537 || this.$store.getters.xt_user.org.id==0|| this.$store.getters.xt_user.org.id==10726){
  1159. var params = {
  1160. drug_id:DrugId,
  1161. start_time:moment().subtract(15, 'days').format("YYYY-MM-DD")
  1162. }
  1163. getDrugTocalCount(params).then(response=>{
  1164. if(response.data.state == 1){
  1165. var adviceList = response.data.data.adviceList
  1166. var drug = response.data.data.drug
  1167. this.scan_code = drug.scan_code
  1168. var str = ""
  1169. if(adviceList!=null && adviceList.length>0){
  1170. for(let i=0;i<adviceList.length;i++){
  1171. if(adviceList[i].drug_code!=""){
  1172. str+=adviceList[i].drug_code
  1173. }
  1174. }
  1175. }
  1176. var new_arr = str.split(",");
  1177. console.log("adviceList==========",new_arr)
  1178. if(new_arr!=null && new_arr.length>0){
  1179. let dataInfo = {}
  1180. new_arr.forEach((item, index) => {
  1181. if (!dataInfo[item]) {
  1182. dataInfo[item] = {
  1183. drug_code:item,
  1184. child: [],
  1185. }
  1186. }
  1187. })
  1188. let arr = Object.values(dataInfo)
  1189. if(arr!=null && arr.length>0){
  1190. for(let i=0;i<arr.length;i++){
  1191. for(let j=0;j<new_arr.length;j++){
  1192. if(arr[i].drug_code == new_arr[j]){
  1193. arr[i].child.push(new_arr[j])
  1194. }
  1195. }
  1196. }
  1197. }
  1198. this.newArrList = []
  1199. this.newArrList = arr
  1200. console.log("newARRlIST----------",this.newArrList)
  1201. }
  1202. this.drug_id = DrugId
  1203. this.id = id
  1204. var is_source =0
  1205. if (DataSources == "his处方"){
  1206. is_source = 1
  1207. }
  1208. if (DataSources == "临时医嘱"){
  1209. is_source = 2
  1210. }
  1211. this.is_source = is_source
  1212. this.textarea = DrugCode
  1213. this.currentIndex = index
  1214. this.dialogVisibleOne = true
  1215. }
  1216. })
  1217. }else{
  1218. this.drug_id = DrugId
  1219. this.id = id
  1220. var is_source =0
  1221. if (DataSources == "his处方"){
  1222. is_source = 1
  1223. }
  1224. if (DataSources == "临时医嘱"){
  1225. is_source = 2
  1226. }
  1227. this.is_source = is_source
  1228. this.textarea = DrugCode
  1229. this.currentIndex = index
  1230. this.dialogVisibleOne = true
  1231. }
  1232. this.$nextTick(()=>{
  1233. this.$refs.inputRef.focus()
  1234. })
  1235. }else{
  1236. this.drug_id = DrugId
  1237. this.id = id
  1238. this.is_source = 3
  1239. this.textarea = DrugCode
  1240. this.currentIndex = index
  1241. this.dialogVisibleOne = true
  1242. }
  1243. },
  1244. saveTextArea(){
  1245. var params = {
  1246. id:this.id,
  1247. data_source:this.is_source,
  1248. drug_code:this.textarea,
  1249. }
  1250. console.log("paramss",params)
  1251. changeDrugCode(params).then(response=>{
  1252. if(response.data.state == 1){
  1253. this.$message.success("保存成功!")
  1254. for(let i=0;i<this.tableData.length;i++){
  1255. if(this.currentIndex == i){
  1256. this.tableData[i].DrugCode = this.textarea
  1257. }
  1258. }
  1259. this.dialogVisibleOne = false
  1260. }
  1261. })
  1262. },
  1263. changeText(event){
  1264. console.log("event------------",event.key)
  1265. // 检查是否为特定的按键,例如回车键,来确认扫码枪输入完成
  1266. if (event.key === 'Enter') {
  1267. var textarea = ""
  1268. textarea += this.textarea.replace(/^\s*[\r\n]|\r?\n\s*$/gm, '') + ","
  1269. if(this.$store.getters.xt_user.org.id == 10138 || this.$store.getters.xt_user.org.id == 10278|| this.$store.getters.xt_user.org.id == 10537 || this.$store.getters.xt_user.org.id == 10610 || this.$store.getters.xt_user.org.id == 10726){
  1270. var drugindentificaitoncode = this.getDrugIdentificationCode(this.drug_id)
  1271. var total_one = 0
  1272. var total_two = 0
  1273. var arr= []
  1274. arr = textarea.split(",")
  1275. var arrList = []
  1276. if(arr!=null && arr.length>0){
  1277. let dataInfo = {}
  1278. arr.forEach((item, index) => {
  1279. if (!dataInfo[item]) {
  1280. dataInfo[item] = {
  1281. drug_code:item,
  1282. child: [],
  1283. }
  1284. }
  1285. })
  1286. let new_arr = Object.values(dataInfo)
  1287. if(new_arr!=null && new_arr.length>0){
  1288. for(let i=0;i<new_arr.length;i++){
  1289. for(let j=0;j<arr.length;j++){
  1290. if(new_arr[i].drug_code == arr[j]){
  1291. new_arr[i].child.push(arr[j])
  1292. }
  1293. }
  1294. }
  1295. }
  1296. arrList = new_arr
  1297. }
  1298. var is_err_check = false
  1299. var i_index = ""
  1300. var drug_code = ""
  1301. if(arr!=null && arr.length>0){
  1302. for(let i=0;i<arr.length;i++){
  1303. if(arr[i]!=""){
  1304. drug_code = arr[i]
  1305. i_index = i
  1306. if(arr[i].length!=20){
  1307. this.$message.error("药品追溯码长度没有满足20位!")
  1308. is_err_check = true
  1309. }
  1310. if(this.$store.getters.xt_user.org.id != 10726){
  1311. if(drugindentificaitoncode>0){
  1312. if(arr[i].substring(0,7)!= drugindentificaitoncode){
  1313. this.$message.error("药品标识码格式不正确,请重新扫码")
  1314. is_err_check = true
  1315. }
  1316. }
  1317. }
  1318. }
  1319. }
  1320. }
  1321. if(is_err_check == true){
  1322. arr.splice(i_index,1)
  1323. }
  1324. for(let i=0;i<this.newArrList.length;i++){
  1325. if(drug_code == this.newArrList[i].drug_code){
  1326. total_one = this.newArrList[i].child.length
  1327. }
  1328. }
  1329. for(let i=0;i<arrList.length;i++){
  1330. if(drug_code == arrList[i].drug_code){
  1331. total_two = arrList[i].child.length
  1332. }
  1333. }
  1334. console.log("数量1--------------",total_one)
  1335. console.log("数量2---------------",total_two)
  1336. if(this.scan_code>0){
  1337. if((total_one + total_two)>this.scan_code){
  1338. this.$message.error("扫码次数已经超过限制!")
  1339. arr.splice(i_index,1)
  1340. }
  1341. }
  1342. var is_arr = this.hasDuplicates(arr)
  1343. this.textarea = arr.join(",")
  1344. }else{
  1345. // console.log("haaaaaaaaaaaaaaaaaaa",textarea)
  1346. var arr = textarea.split(",");
  1347. var lastElement = arr[arr.length - 2];
  1348. if(lastElement.length!=20){
  1349. this.$message.error("药品追溯码长度没有满足20位!")
  1350. arr.splice(arr.length-2,1)
  1351. }
  1352. console.log("arr-------------",arr)
  1353. this.textarea = ""
  1354. this.textarea = arr.join(",")
  1355. // this.textarea = textarea
  1356. }
  1357. }
  1358. this.getTotal()
  1359. },
  1360. hasDuplicates(arr) {
  1361. const uniqueNumbers = [...new Set(arr)];
  1362. return uniqueNumbers.length !== arr.length;
  1363. },
  1364. getDrugIdentificationCode(id){
  1365. var drug_identification_code = ""
  1366. for(let i=0;i<this.baseList.length;i++){
  1367. if(id == this.baseList[i].id){
  1368. drug_identification_code = this.baseList[i].drug_identification_code
  1369. }
  1370. }
  1371. return drug_identification_code
  1372. },
  1373. },
  1374. watch:{
  1375. }
  1376. };
  1377. </script>
  1378. <style rel="stylesheet/css" lang="scss" scoped>
  1379. .new-main-contain {
  1380. height: 100%;
  1381. display: flex;
  1382. flex-direction: column;
  1383. }
  1384. .app-container {
  1385. height: 100%;
  1386. }
  1387. .mainLeft {
  1388. width: 200px;
  1389. height: 100%;
  1390. display: flex;
  1391. flex-direction: column;
  1392. .el-radio {
  1393. margin-right: 5px;
  1394. }
  1395. .list {
  1396. margin: 10px 0;
  1397. }
  1398. }
  1399. .mainRight {
  1400. margin-left: 10px;
  1401. flex: 1;
  1402. height: 100%;
  1403. display: flex;
  1404. flex-direction: column;
  1405. overflow-y: auto;
  1406. .titlelist {
  1407. display: flex;
  1408. justify-content: space-between;
  1409. white-space: nowrap;
  1410. color: #909399;
  1411. font-size: 14px;
  1412. /deep/ .el-input__inner {
  1413. font-size: 13px !important;
  1414. }
  1415. }
  1416. .el-table {
  1417. margin-top: -13px;
  1418. }
  1419. .el-button {
  1420. height: 34px;
  1421. width: 65px;
  1422. }
  1423. /deep/ .el-divider {
  1424. height: 2px;
  1425. margin-top: 10px;
  1426. }
  1427. /deep/ .el-table__body-wrapper {
  1428. overflow-x: scroll !important;
  1429. }
  1430. }
  1431. /deep/ .el-input__inner {
  1432. padding-right: 15px;
  1433. }
  1434. /deep/ .el-table--scrollable-x .el-table__body-wrapper {
  1435. overflow: auto;
  1436. overflow-x: hidden;
  1437. }
  1438. /deep/ .gutter {
  1439. width: 15px !important;
  1440. display: inline-block !important;
  1441. }
  1442. /deep/ .el-table__fixed-right-patch {
  1443. width: 15px !important;
  1444. }
  1445. /deep/ .el-table__fixed-right {
  1446. bottom: 0 !important;
  1447. left: auto;
  1448. right: 0;
  1449. }
  1450. /deep/ .el-table__body-wrapper::-webkit-scrollbar {
  1451. width: 15px !important;
  1452. height: 15px !important;
  1453. }
  1454. </style>