PatientDispensing.vue 41KB

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