DrugDispensing.vue 48KB

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