PatientDispensing.vue 49KB

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