PatientDispensing.vue 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  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. <el-input style="width: 100;" v-model="scope.row.DrugCode" @input="changeDrugCode(scope.row.ID,scope.row.DataSources,scope.row.DrugCode)"></el-input>
  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. <div
  263. style="
  264. height: 50px;
  265. background: #c7ebfc;
  266. border-radius: 5px;
  267. padding: 7px;
  268. "
  269. >
  270. <i class="el-icon-info" style="color: #3399ff; font-size: 17px"></i>
  271. 若选择为是,则通过药房发药的药品都会在发药之后进行出库,否则按原来的方式进行出库管理
  272. </div>
  273. <span slot="footer" class="dialog-footer">
  274. <el-button @click="dialogVisible = false">取 消</el-button>
  275. <el-button type="primary" @click="SaveSetting">保 存</el-button>
  276. </span>
  277. </el-dialog>
  278. </div>
  279. <patient-print
  280. ref="patientprint"
  281. :visibility="isVisibility"
  282. :propsTable="propsTable"
  283. >
  284. </patient-print>
  285. <patientPrintTwo ref="patientprintTwo"
  286. :visibility="isVisibilityTwo"
  287. :propsTable="propsTable"
  288. >
  289. </patientPrintTwo>
  290. </div>
  291. </template>
  292. <script>
  293. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  294. import patientPrint from "./print/patientPrint.vue";
  295. import patientPrintTwo from './print/patientPrintTwo'
  296. import { getPharmacyConfig, SaveSetting } from "@/api/his/advice";
  297. import {
  298. waitingdrug,
  299. issueddrugs,
  300. todaynumber,
  301. getpharmacycontent,
  302. dispensingmedicine,
  303. drugwithdrawal,
  304. getpartitionlist,
  305. changeDrugCode
  306. } from "@/api/pharmacy";
  307. import dataDruguse from "../../router/modules/dataDruguse";
  308. const moment = require("moment");
  309. export default {
  310. components: {
  311. BreadCrumb,
  312. patientPrint,
  313. patientPrintTwo
  314. },
  315. data() {
  316. return {
  317. patient_id: 0,
  318. crumbs: [
  319. { path: false, name: "药房管理" },
  320. { path: "/Pharmacy/patiantDispensing", name: "患者发药" },
  321. ],
  322. tableHeight: 400,
  323. start_time: moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
  324. start_time2: moment(new Date()).add("year", 0).format("YYYY-MM-DD HH:mm"),
  325. state: 1, //1待发药,2已发药
  326. waitmount: 0, //待发药人数
  327. waitmount_data: [],
  328. alreadmount: 0, //已发药人数
  329. alreadmount_data: [],
  330. keywords: "",
  331. tableData: [],
  332. propsTable: [],
  333. tableData_list: [],
  334. isVisibility: false,
  335. isVisibilityTwo:false,
  336. currentRow: null,
  337. dialogVisible: false,
  338. is_open: "2",
  339. banshift: [
  340. { value: 0, text: "全部班" },
  341. { value: 1, text: "上午" },
  342. { value: 2, text: "下午" },
  343. { value: 3, text: "晚上" },
  344. ],
  345. shift: 0, //班次
  346. fen: [],
  347. partition: 0, //分区
  348. drugList:[],
  349. baseList:[],
  350. org_id:'',
  351. patients:{},
  352. doctors:[],
  353. diagnosearr:[],
  354. diagnosis:'',
  355. };
  356. },
  357. watch: {},
  358. created() {
  359. this.init();
  360. this.gettodaynumber();
  361. this.fun3();
  362. this.getgetpartitionlist();
  363. this.org_id = this.$store.getters.xt_user.org.id
  364. // this.getwaitmount();//fun3
  365. // this.selectedbydefault();
  366. },
  367. methods: {
  368. getgetpartitionlist() {
  369. var params = {};
  370. getpartitionlist(params).then((res) => {
  371. if (res.data.state == 1) {
  372. this.fen = res.data.data.list;
  373. }
  374. });
  375. },
  376. tiaoshi() {
  377. console.log("this.shift", this.shift);
  378. console.log("this.partition", this.partition);
  379. console.log("this.waitmount_data", this.waitmount_data);
  380. console.log("this.alreadmount_data", this.alreadmount_data);
  381. console.log("this.waitmount", this.waitmount);
  382. console.log("this.alreadmount", this.alreadmount);
  383. },
  384. async fun3() {
  385. console.log("fun3");
  386. this.fun1().then((val) => {
  387. this.fun2();
  388. });
  389. },
  390. async fun4(tmp) {
  391. console.log("fun3");
  392. this.fun1().then((val) => {
  393. console.log("this.alreadmount_data", this.alreadmount_data);
  394. for (let i = 0; i < this.alreadmount_data.length; i++) {
  395. console.log("tmp = ", tmp);
  396. if (this.alreadmount_data[i].PatientID == tmp) {
  397. console.log("i = ", i);
  398. this.$refs.table02.setCurrentRow(this.alreadmount_data[i]);
  399. this.handleCurrentChange(this.alreadmount_data[i]);
  400. }
  401. }
  402. });
  403. },
  404. async fun5(tmp) {
  405. console.log("fun5555");
  406. this.fun1().then((val) => {
  407. console.log("this.alreadmount_data", this.waitmount_data);
  408. for (let i = 0; i < this.waitmount_data.length; i++) {
  409. console.log("tmp = ", tmp);
  410. if (this.waitmount_data[i].PatientID == tmp) {
  411. console.log("i = ", i);
  412. this.$refs.table01.setCurrentRow(this.waitmount_data[i]);
  413. this.handleCurrentChange(this.waitmount_data[i]);
  414. }
  415. }
  416. });
  417. },
  418. lala() {
  419. console.log("this.state!!!!!!", this.state);
  420. //初始化状态
  421. this.tableData = null;
  422. this.currentRow = null;
  423. this.selectedbydefault();
  424. },
  425. //选中行数
  426. handleCurrentChange(val) {
  427. console.log("state--",this.state)
  428. this.currentRow = val;
  429. console.log("this.currentRow", this.currentRow);
  430. if (this.state == 1) {
  431. this.getpatientdetails(0);
  432. }
  433. if (this.state == 2) {
  434. this.getpatientdetails(1);
  435. }
  436. },
  437. init() {
  438. // console.log("初始化了")
  439. this.state = 1;
  440. this.tableData = null;
  441. this.currentRow = null;
  442. this.partition = 0;
  443. this.shift = 0;
  444. },
  445. testsss() {
  446. this.state = 1;
  447. },
  448. //默认选中的
  449. selectedbydefault() {
  450. if (this.state == 1 && this.waitmount_data.length > 0) {
  451. this.$refs.table01.setCurrentRow(this.waitmount_data[0]);
  452. this.handleCurrentChange(this.waitmount_data[0]);
  453. }
  454. if (this.state == 2 && this.alreadmount_data.length > 0) {
  455. this.$refs.table02.setCurrentRow(this.alreadmount_data[0]);
  456. this.handleCurrentChange(this.alreadmount_data[0]);
  457. }
  458. },
  459. //包装selectedbydefault
  460. fun2() {
  461. console.log("3333333this.waitmount_data", this.waitmount_data);
  462. // return new Promise((resolve, reject) => {
  463. if (this.state == 1 && this.waitmount_data.length > 0) {
  464. this.$refs.table01.setCurrentRow(this.waitmount_data[0]);
  465. this.handleCurrentChange(this.waitmount_data[0]);
  466. }
  467. if (this.state == 2 && this.alreadmount_data.length > 0) {
  468. this.$refs.table02.setCurrentRow(this.alreadmount_data[0]);
  469. this.handleCurrentChange(this.alreadmount_data[0]);
  470. }
  471. // });
  472. },
  473. changeTimes() {
  474. this.gettodaynumber();
  475. this.getwaitmount();
  476. this.fun3();
  477. },
  478. //获取当天发药的人数
  479. gettodaynumber() {
  480. var params = {
  481. time: this.start_time,
  482. };
  483. todaynumber(params).then((res) => {
  484. if (res.data.state == 1) {
  485. console.log('3333333',res.data.data);
  486. this.waitmount = res.data.data.itotal;
  487. this.alreadmount = res.data.data.wtotal;
  488. this.drugList = res.data.data.drug
  489. }
  490. });
  491. // console.log("2222222")
  492. },
  493. //获取发药人列表
  494. getwaitmount() {
  495. var params = {
  496. keyword: this.keywords,
  497. time: this.start_time,
  498. shift: this.shift,
  499. partition: this.partition,
  500. };
  501. console.log("班次---------------------",params)
  502. waitingdrug(params).then((res) => {
  503. if (res.data.state == 1) {
  504. this.waitmount_data = res.data.data.list;
  505. this.baseList =[]
  506. this.baseList = res.data.data.baseList
  507. if (this.shift != 0 || this.partition != 0) {
  508. if (this.waitmount_data == null) {
  509. this.waitmount = 0;
  510. } else {
  511. this.waitmount = this.waitmount_data.length;
  512. }
  513. }
  514. }
  515. });
  516. issueddrugs(params).then((res) => {
  517. if (res.data.state == 1) {
  518. this.alreadmount_data = res.data.data.list;
  519. if (this.shift != 0 || this.partition != 0) {
  520. if (this.alreadmount_data == null) {
  521. this.alreadmount = 0;
  522. } else {
  523. this.alreadmount = this.alreadmount_data.length;
  524. }
  525. }
  526. }
  527. });
  528. },
  529. //包装getwaitmount
  530. async fun1() {
  531. // return new Promise((resolve, reject) => {
  532. var params = {
  533. keyword: this.keywords,
  534. time: this.start_time,
  535. shift: this.shift,
  536. partition: this.partition,
  537. };
  538. await waitingdrug(params).then((res) => {
  539. if (res.data.state == 1) {
  540. this.waitmount_data = res.data.data.list;
  541. console.log("1111111");
  542. }
  543. });
  544. await issueddrugs(params).then((res) => {
  545. if (res.data.state == 1) {
  546. this.alreadmount_data = res.data.data.list;
  547. console.log("1111111s");
  548. }
  549. });
  550. console.log("222222222");
  551. // })
  552. },
  553. //获取患者信息详情
  554. getpatientdetails(val) {
  555. console.log("val2332323223",this.currentRow)
  556. var params = {
  557. patient_id: this.currentRow.PatientID,
  558. is_medicine: val,
  559. time: this.start_time,
  560. };
  561. getpharmacycontent(params).then((res) => {
  562. if (res.data.state == 1) {
  563. var list = res.data.data.list;
  564. console.log("hhhhawoowowow",res.data.data)
  565. this.baseList =[]
  566. this.baseList = res.data.data.baseList
  567. this.doctors = res.data.data.doctors
  568. this.diagnosearr = res.data.data.diagnose
  569. this.diagnosis = res.data.data.prescription.diagnosis
  570. const obj={
  571. age:res.data.data.patients.age,
  572. gender: res.data.data.patients.gender,
  573. diagnose:res.data.data.patients.diagnose,
  574. zhixing:res.data.data.patients.created_time
  575. }
  576. this.patients =obj
  577. 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 ){
  578. this.tableData = []
  579. if(list!=null && list.length >0){
  580. for(let i=0;i<list.length;i++){
  581. if(list[i].DataSources != "临时医嘱"){
  582. this.tableData.push(list[i])
  583. }
  584. }
  585. }
  586. }
  587. 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 ){
  588. this.tableData = []
  589. this.tableData = list
  590. }
  591. console.log("tableDatawoowow",this.tableData)
  592. } else {
  593. this.$message.error(res.data.msg);
  594. }
  595. });
  596. },
  597. // 跳转打印页面
  598. toPrint() {
  599. if (this.tableData == null) {
  600. this.$message.error("未选择任何数据");
  601. return;
  602. }else{
  603. if(this.org_id != 10653 && this.org_id !=0){
  604. this.$refs.patientprint.show(
  605. this.tableData,
  606. this.currentRow,
  607. this.state,
  608. this.start_time
  609. );
  610. }else{
  611. this.$refs.patientprintTwo.show(
  612. this.tableData,
  613. this.currentRow,
  614. this.state,
  615. this.start_time,
  616. this.baseList,
  617. this.patients,
  618. this.doctors,
  619. this.diagnosearr,
  620. this.diagnosis,
  621. )
  622. }
  623. }
  624. },
  625. toExport() {
  626. import("@/vendor/Export2Excel").then((excel) => {
  627. for (let i = 0; i < this.tableData.length; i++) {
  628. this.tableData[i].index = i + 1;
  629. this.tableData[i].time = this.start_time;
  630. this.tableData[i].uname = this.currentRow.Name;
  631. }
  632. const tHeader = [
  633. "序号",
  634. "日期",
  635. "患者名称",
  636. "名称",
  637. "单次用量",
  638. "用法",
  639. "频率",
  640. "天数",
  641. "总量",
  642. "开立医生",
  643. "数据来源",
  644. "备注",
  645. ];
  646. const filterVal = [
  647. "index",
  648. "time",
  649. "uname",
  650. "Name",
  651. "SingleDosage",
  652. "Usage",
  653. "Frequency",
  654. "Days",
  655. "Total",
  656. "Doctor",
  657. "DataSources",
  658. "Remarks",
  659. ];
  660. const data = this.formatJson(filterVal, this.tableData);
  661. excel.export_json_to_excel({
  662. header: tHeader,
  663. data,
  664. filename: "领药单",
  665. });
  666. this.downloadLoading = false;
  667. });
  668. },
  669. formatJson(filterVal, jsonData) {
  670. return jsonData.map((v) => filterVal.map((j) => v[j]));
  671. },
  672. // 搜索患者
  673. searchAction() {
  674. this.tableData = null;
  675. this.getwaitmount();
  676. if (this.shift != 0 || this.partition != 0) {
  677. } else {
  678. this.gettodaynumber();
  679. }
  680. },
  681. // 药品发药
  682. dispense() {
  683. var tmp = this.currentRow.PatientID;
  684. var params = {
  685. patient_id: this.currentRow.PatientID,
  686. time: this.start_time,
  687. };
  688. this.$confirm("确定是否对该患者进行发药?", "患者发药", {
  689. confirmButtonText: "确 定",
  690. cancelButtonText: "取 消",
  691. type: "warning",
  692. }).then(() => {
  693. dispensingmedicine(params).then((res) => {
  694. if (res.data.state == 1) {
  695. this.$message.success("操作成功");
  696. this.gettodaynumber();
  697. this.searchAction();
  698. this.tableData = null;
  699. this.fun4(tmp);
  700. this.state = 2;
  701. } else {
  702. this.$message.error(res.data.msg);
  703. }
  704. });
  705. })
  706. .catch(() => {});
  707. },
  708. toSetting() {
  709. getPharmacyConfig().then((response) => {
  710. if (response.data.state == 1) {
  711. this.dialogVisible = true;
  712. var config = response.data.data.config;
  713. this.is_open = config.is_open.toString();
  714. }
  715. });
  716. },
  717. SaveSetting() {
  718. var params = {
  719. is_open: parseInt(this.is_open),
  720. };
  721. SaveSetting(params).then((response) => {
  722. if (response.data.state == 1) {
  723. var config = response.data.data.config;
  724. this.$message.success("保存成功!");
  725. this.dialogVisible = false;
  726. }
  727. });
  728. },
  729. // 药品退药
  730. endispense() {
  731. var tmp = this.currentRow.PatientID;
  732. var params = {
  733. patient_id: this.currentRow.PatientID,
  734. time: this.start_time,
  735. };
  736. this.$confirm("确定是否对该患者进行退药?", "患者退药", {
  737. confirmButtonText: "确 定",
  738. cancelButtonText: "取 消",
  739. type: "warning",
  740. }).then(() => {
  741. drugwithdrawal(params).then((res) => {
  742. if (res.data.state == 1) {
  743. this.$message.success("操作成功");
  744. this.gettodaynumber();
  745. this.searchAction();
  746. this.tableData = null;
  747. this.fun5(tmp);
  748. this.state = 1;
  749. } else {
  750. this.$message.error(res.data.msg);
  751. }
  752. });
  753. })
  754. .catch(() => {});
  755. },
  756. getDrugName(drug_id){
  757. var medical_insurance_number = ""
  758. for(let i=0;i<this.drugList.length;i++){
  759. if(drug_id == this.drugList[i].id){
  760. medical_insurance_number = this.drugList[i].medical_insurance_number
  761. }
  762. }
  763. return medical_insurance_number
  764. },
  765. getManutuer(drug_id){
  766. var manufacturer_name = ""
  767. for(let i=0;i<this.baseList.length;i++){
  768. if(drug_id == this.baseList[i].id){
  769. manufacturer_name = this.baseList[i].manufacturer_name
  770. }
  771. }
  772. return manufacturer_name
  773. },
  774. getSpecaiName(drug_id){
  775. var spc =""
  776. for(let i=0;i<this.baseList.length;i++){
  777. if(drug_id == this.baseList[i].id){
  778. 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
  779. }
  780. }
  781. return spc
  782. },
  783. changeDrugCode(id,DataSources,drug_code){
  784. var is_source =0
  785. if (DataSources == "his处方"){
  786. is_source = 1
  787. }
  788. if (DataSources == "临时医嘱"){
  789. is_source = 2
  790. }
  791. var params = {
  792. id:id,
  793. data_source:is_source,
  794. drug_code:drug_code,
  795. }
  796. console.log("paramss",params)
  797. changeDrugCode(params).then(response=>{
  798. if(response.data.state == 1){
  799. this.$message.success("保存成功!")
  800. }
  801. })
  802. }
  803. },
  804. };
  805. </script>
  806. <style rel="stylesheet/css" lang="scss" scoped>
  807. .new-main-contain {
  808. height: 100%;
  809. display: flex;
  810. flex-direction: column;
  811. }
  812. .app-container {
  813. height: 100%;
  814. }
  815. .mainLeft {
  816. width: 200px;
  817. height: 100%;
  818. display: flex;
  819. flex-direction: column;
  820. .el-radio {
  821. margin-right: 5px;
  822. }
  823. .list {
  824. margin: 10px 0;
  825. }
  826. }
  827. .mainRight {
  828. margin-left: 10px;
  829. flex: 1;
  830. height: 100%;
  831. display: flex;
  832. flex-direction: column;
  833. overflow-y: auto;
  834. .titlelist {
  835. display: flex;
  836. justify-content: space-between;
  837. white-space: nowrap;
  838. color: #909399;
  839. font-size: 14px;
  840. /deep/ .el-input__inner {
  841. font-size: 13px !important;
  842. }
  843. }
  844. .el-table {
  845. margin-top: -13px;
  846. }
  847. .el-button {
  848. height: 34px;
  849. width: 65px;
  850. }
  851. /deep/ .el-divider {
  852. height: 2px;
  853. margin-top: 10px;
  854. }
  855. /deep/ .el-table__body-wrapper {
  856. overflow-x: scroll !important;
  857. }
  858. }
  859. /deep/ .el-input__inner {
  860. padding-right: 15px;
  861. }
  862. /deep/ .el-table--scrollable-x .el-table__body-wrapper {
  863. overflow: auto;
  864. overflow-x: hidden;
  865. }
  866. /deep/ .gutter {
  867. width: 15px !important;
  868. display: inline-block !important;
  869. }
  870. /deep/ .el-table__fixed-right-patch {
  871. width: 15px !important;
  872. }
  873. /deep/ .el-table__fixed-right {
  874. bottom: 0 !important;
  875. left: auto;
  876. right: 0;
  877. }
  878. /deep/ .el-table__body-wrapper::-webkit-scrollbar {
  879. width: 15px !important;
  880. height: 15px !important;
  881. }
  882. </style>