PatientDispensing.vue 49KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605
  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---------------",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. if(this.drug_type == 1){ //药品
  1265. // 检查是否为特定的按键,例如回车键,来确认扫码枪输入完成
  1266. if (event.key === 'Enter') {
  1267. var textarea = ""
  1268. textarea += this.textarea.replace(/^\s*[\r\n]|\r?\n\s*$/gm, '') + ","
  1269. // var textAreaList = this.textarea.split(",")
  1270. // var textarea = ""
  1271. // textarea += this.textarea.replace(/^\s*[\r\n]|\r?\n\s*$/gm, '') + ","
  1272. // var parts = textarea.split(',')
  1273. // for(let i=0;i<textAreaList.length;i++){
  1274. // if(parts[parts.length-2] == textAreaList[i]){
  1275. // this.$message.error("该条码已经存在,不能重复扫码")
  1276. // }
  1277. // }
  1278. // const uniqueStr = [...new Set(textarea.split(','))].join(',');
  1279. // var textarea = uniqueStr
  1280. 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){
  1281. var drugindentificaitoncode = this.getDrugIdentificationCode(this.drug_id)
  1282. var total_one = 0
  1283. var total_two = 0
  1284. var arr= []
  1285. arr = textarea.split(",")
  1286. var arrList = []
  1287. if(arr!=null && arr.length>0){
  1288. let dataInfo = {}
  1289. arr.forEach((item, index) => {
  1290. if (!dataInfo[item]) {
  1291. dataInfo[item] = {
  1292. drug_code:item,
  1293. child: [],
  1294. }
  1295. }
  1296. })
  1297. let new_arr = Object.values(dataInfo)
  1298. if(new_arr!=null && new_arr.length>0){
  1299. for(let i=0;i<new_arr.length;i++){
  1300. for(let j=0;j<arr.length;j++){
  1301. if(new_arr[i].drug_code == arr[j]){
  1302. new_arr[i].child.push(arr[j])
  1303. }
  1304. }
  1305. }
  1306. }
  1307. arrList = new_arr
  1308. }
  1309. var is_err_check = false
  1310. var i_index = ""
  1311. var drug_code = ""
  1312. if(arr!=null && arr.length>0){
  1313. for(let i=0;i<arr.length;i++){
  1314. if(arr[i]!=""){
  1315. drug_code = arr[i]
  1316. i_index = i
  1317. if(arr[i].length!=20){
  1318. this.$message.error("药品追溯码长度没有满足20位!")
  1319. is_err_check = true
  1320. }
  1321. if(this.$store.getters.xt_user.org.id != 10726){
  1322. if(drugindentificaitoncode>0){
  1323. if(arr[i].substring(0,7)!= drugindentificaitoncode){
  1324. this.$message.error("药品标识码格式不正确,请重新扫码")
  1325. is_err_check = true
  1326. }
  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. if(this.scan_code>0){
  1348. if((total_one + total_two)>this.scan_code){
  1349. this.$message.error("扫码次数已经超过限制!")
  1350. arr.splice(i_index,1)
  1351. }
  1352. }
  1353. var is_arr = this.hasDuplicates(arr)
  1354. this.textarea = arr.join(",")
  1355. }else{
  1356. // console.log("haaaaaaaaaaaaaaaaaaa",textarea)
  1357. var arr = textarea.split(",");
  1358. var lastElement = arr[arr.length - 2];
  1359. if(lastElement.length!=20){
  1360. this.$message.error("药品追溯码长度没有满足20位!")
  1361. arr.splice(arr.length-2,1)
  1362. }
  1363. console.log("arr-------------",arr)
  1364. this.textarea = ""
  1365. this.textarea = arr.join(",")
  1366. // this.textarea = textarea
  1367. }
  1368. }
  1369. }else{ //耗材
  1370. if (event.key === 'Enter') {
  1371. var textarea = ""
  1372. textarea += this.textarea + ","
  1373. this.textarea = textarea
  1374. }
  1375. }
  1376. this.getTotal()
  1377. },
  1378. hasDuplicates(arr) {
  1379. const uniqueNumbers = [...new Set(arr)];
  1380. return uniqueNumbers.length !== arr.length;
  1381. },
  1382. getDrugIdentificationCode(id){
  1383. var drug_identification_code = ""
  1384. for(let i=0;i<this.baseList.length;i++){
  1385. if(id == this.baseList[i].id){
  1386. drug_identification_code = this.baseList[i].drug_identification_code
  1387. }
  1388. }
  1389. return drug_identification_code
  1390. },
  1391. },
  1392. watch:{
  1393. }
  1394. };
  1395. </script>
  1396. <style rel="stylesheet/css" lang="scss" scoped>
  1397. .new-main-contain {
  1398. height: 100%;
  1399. display: flex;
  1400. flex-direction: column;
  1401. }
  1402. .app-container {
  1403. height: 100%;
  1404. }
  1405. .mainLeft {
  1406. width: 200px;
  1407. height: 100%;
  1408. display: flex;
  1409. flex-direction: column;
  1410. .el-radio {
  1411. margin-right: 5px;
  1412. }
  1413. .list {
  1414. margin: 10px 0;
  1415. }
  1416. }
  1417. .mainRight {
  1418. margin-left: 10px;
  1419. flex: 1;
  1420. height: 100%;
  1421. display: flex;
  1422. flex-direction: column;
  1423. overflow-y: auto;
  1424. .titlelist {
  1425. display: flex;
  1426. justify-content: space-between;
  1427. white-space: nowrap;
  1428. color: #909399;
  1429. font-size: 14px;
  1430. /deep/ .el-input__inner {
  1431. font-size: 13px !important;
  1432. }
  1433. }
  1434. .el-table {
  1435. margin-top: -13px;
  1436. }
  1437. .el-button {
  1438. height: 34px;
  1439. width: 65px;
  1440. }
  1441. /deep/ .el-divider {
  1442. height: 2px;
  1443. margin-top: 10px;
  1444. }
  1445. /deep/ .el-table__body-wrapper {
  1446. overflow-x: scroll !important;
  1447. }
  1448. }
  1449. /deep/ .el-input__inner {
  1450. padding-right: 15px;
  1451. }
  1452. /deep/ .el-table--scrollable-x .el-table__body-wrapper {
  1453. overflow: auto;
  1454. overflow-x: hidden;
  1455. }
  1456. /deep/ .gutter {
  1457. width: 15px !important;
  1458. display: inline-block !important;
  1459. }
  1460. /deep/ .el-table__fixed-right-patch {
  1461. width: 15px !important;
  1462. }
  1463. /deep/ .el-table__fixed-right {
  1464. bottom: 0 !important;
  1465. left: auto;
  1466. right: 0;
  1467. }
  1468. /deep/ .el-table__body-wrapper::-webkit-scrollbar {
  1469. width: 15px !important;
  1470. height: 15px !important;
  1471. }
  1472. </style>