12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268 |
- <template>
- <!--药品发药页面-->
- <div class="main-contain new-main-contain">
- <div class="position">
- <!-- <bread-crumb :crumbs='crumbs'></bread-crumb>-->
- <bread-crumb :crumbs="crumbs"></bread-crumb>
- </div>
- <div
- class="app-container"
- style="display: flex; flex: 1; padding: 10px 20px 0px 20px"
- >
- <div class="mainLeft">
- <div>
- <div class="list">
- <el-date-picker
- style="width: 300px"
- v-model="start_time"
- type="date"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- placeholder="选择日期"
- @change="changeTimes()"
- >
- </el-date-picker>
- </div>
-
- <div class="list">
- <el-radio-group v-model="state" @change="lala()">
- <el-radio :label="1">待发药</el-radio>
- <el-radio :label="2">已发药</el-radio>
- </el-radio-group>
- </div>
- <div class="list">
- <el-input
- size="small"
- style="width: 239px"
- v-model="keywords"
- class="filter-item"
- placeholder="请输入药品名称"
- />
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- @click="searchAction"
- >搜索
- </el-button>
- </div>
-
- <el-table
- v-if="state == 1"
- height="60vh"
- :data="waiting_drug"
- border
- style="width: 100%"
- highlight-current-row
- ref="table01"
- @current-change="handleCurrentChange"
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266',
- }"
- >
- <el-table-column prop="name" label="名称" width="100">
- <template slot-scope="scope">
- {{ scope.row.name }}
- </template>
- </el-table-column>
- <el-table-column prop="specifications" label="规格" width="100">
- <template slot-scope="scope">
- {{ scope.row.specifications }}
- </template>
- </el-table-column>
- <el-table-column prop="stock" label="库存" width="100">
- <template slot-scope="scope">
- {{ scope.row.stock }}
- </template>
- </el-table-column>
- </el-table>
-
- <el-table
- v-if="state == 2"
- :height="tableHeight"
- :data="issued_drug"
- border
- style="width: 100%"
- highlight-current-row
- @current-change="handleCurrentChange"
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266',
- }"
- ref="table02"
- >
- <el-table-column prop="name" label="名称" width="100">
- <template slot-scope="scope">
- {{ scope.row.name }}
- </template>
- </el-table-column>
- <el-table-column prop="specifications" label="规格" width="100">
- <template slot-scope="scope">
- {{ scope.row.specifications }}
- </template>
- </el-table-column>
- <el-table-column prop="stock" label="库存" width="100">
- <template slot-scope="scope">
- {{ scope.row.stock }}
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <div class="mainRight">
- <div class="titlelist">
- <div>
- 班次:
- <el-select
- v-model="shift"
- placeholder="请选择"
- @change="getdrugsdetails"
- >
- <el-option
- v-for="item in banshift"
- :key="item.value"
- :label="item.text"
- :value="item.value"
- >
- </el-option>
- </el-select>
- 分区:
- <el-select
- v-model="partition"
- placeholder="请选择"
- @change="getdrugsdetails"
- >
- <el-option
- v-for="item in fen"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- 给药途径:
- <el-select
- v-model="deliveryway"
- placeholder="请选择"
- @change="getdruglist02"
- >
- <el-option
- v-for="item in routeofadministration"
- :key="item.name"
- :label="item.name"
- :value="item.name"
- >
- </el-option>
- </el-select>
- </div>
- <div>
- <el-button type="primary" @click="toExport" v-if="state == 2"
- >导出</el-button
- >
- <!-- <el-button type="primary" @click="tt">调试</el-button>-->
- <el-button type="primary" @click="dispense" v-if="state == 1"
- >发药</el-button
- >
- <el-button type="primary" @click="toPrint">打印</el-button>
- <!-- <el-button @click="tt">调试</el-button>-->
- </div>
- </div>
-
- <el-divider></el-divider>
- <div class="right_table">
- <el-table
- ref="table_01"
- :height="tableHeight"
- :data="tableData"
- :summary-method="getSummaries_t1"
- show-summary
- border
- highlight-current-row
- style="width: 100%"
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266',
- }"
- @selection-change="handleSelectionChange"
- v-if="state == 1"
- >
- <el-table-column type="selection" width="55" align="center">
- </el-table-column>
- <el-table-column
- type="index"
- label="序号"
- width="120"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="name"
- label="患者名称"
- width="180"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.name }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="单次用量"
- width="170"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.single_dosage }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="用法"
- width="160"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.usage }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="频率"
- width="160"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.frequency }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="天数"
- width="160"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.days }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="总量"
- width="160"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.total }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="数据来源"
- width="162"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.data_sources }}
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="right_table">
- <el-table
- ref="table_01"
- :height="tableHeight"
- :data="tableData"
- :summary-method="getSummaries_t2"
- show-summary
- border
- highlight-current-row
- style="width: 100%"
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266',
- }"
- @selection-change="handleSelectionChange"
- v-if="state == 2"
- >
- <!-- <el-table-column type="selection" width="55"> </el-table-column>-->
- <el-table-column
- type="index"
- label="序号"
- width="120"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="name"
- label="患者名称"
- width="180"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.name }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="单次用量"
- width="170"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.single_dosage }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="用法"
- width="160"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.usage }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="频率"
- width="160"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.frequency }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="天数"
- width="160"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.days }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="总量"
- width="160"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.total }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="数据来源"
- width="162"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.data_sources }}
- </template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="领药人"
- width="160"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.people }}
- </template>
- </el-table-column>
- </el-table>
- </div>
-
- <!-- <div style="background-color: #f5f7fa;display:flex;padding: 10px;justify-content:space-around;position:absolute;width:75.6%;margin-top: 27.5%;
- "><div style="width: 40%;padding-left:3%">合计 </div> <div style="width: 40%;display: flex;justify-content:center;padding-left: 37%">{{total}}</div></div> -->
- <div style="margin-top: 25px; display: flex" v-if="state == 1">
- <span style="line-height: 36px">领药人:</span>
- <el-select v-model="admin_user_id" placeholder="请选择">
- <el-option
- v-for="item in doctorList"
- :key="item.admin_user_id"
- :label="item.user_name"
- :value="item.admin_user_id"
- >
- </el-option>
- </el-select>
-
- <span
- style="display: inline-block;padding-left: 30px;line-height: 36px;}"
- >选中: {{ select_total }}</span
- >
- </div>
- </div>
-
- <el-dialog title="设置" :visible.sync="dialogVisible" width="30%">
- <span style="font-size: 17px">请选择药品是否要通过药房管理出库</span>
- <span style="display: block; padding: 18px 25px">
- <el-radio v-model="is_open" label="1">是</el-radio>
- <el-radio v-model="is_open" label="2">否</el-radio>
- </span>
- <div
- style="
- height: 50px;
- background: #c7ebfc;
- border-radius: 5px;
- padding: 7px;
- "
- >
- <i class="el-icon-info" style="color: #3399ff; font-size: 17px"></i>
- 若选择为是,则通过药房发药的药品都会在发药之后进行出库,否则按原来的方式进行出库管理
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="SaveSetting">保 存</el-button>
- </span>
- </el-dialog>
- </div>
-
- <drug-print
- ref="drugprint"
- :visibility="isVisibility"
- :propsTable="propsTable"
- :state="state"
- >
- </drug-print>
- </div>
- </template>
-
- <script>
- import drugPrint from "./print/drugPrint.vue";
- import BreadCrumb from "@/xt_pages/components/bread-crumb";
- import {
- getTodayAdviceList,
- getPharmacyBaseDrug,
- updatePharmacyBaseDrug,
- SaveSetting,
- getPharmacyConfig,
- getUserdDrugList,
- } from "@/api/his/advice";
- import {
- dispensemedicine,
- waitingmedicine,
- getpatientswithdrugs,
- medicinedeparture,
- getcurrentname,
- getpartitionlist,
- routeofadministration,
- } from "@/api/pharmacy";
- const moment = require("moment");
- export default {
- components: {
- BreadCrumb,
- drugPrint,
- },
- data() {
- return {
- crumbs: [
- { path: false, name: "药房管理" },
- { path: "/Pharmacy/DrugDispensing", name: "药品发药" },
- ],
- tableHeight: 490,
- datepick: "",
- state: 1,
- waitmount: 0,
- alreadmount: 0,
- tableData: [],
- tableData_list: [],
- tableList: [],
- multipleSelection: [],
- start_time: moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
- patientList: [],
- keywords: "",
- dialogVisible: false,
- is_open: "2",
- isVisibility: "",
- propsTable: "",
- doctorList: [],
- admin_user_id: 0,
- waiting_drug: [], //待发药列表
- issued_drug: [], //已发药列表
- currentRow: null,
- tmp: 0,
- banshift: [
- { value: 0, text: "全部班" },
- { value: 1, text: "上午" },
- { value: 2, text: "下午" },
- { value: 3, text: "晚上" },
- ],
- shift: 0, //班次
- fen: [],
- partition: 0, //分区
- routeofadministration: [],
- deliveryway: "全部", //给药途径
- total: "", //合计
- select_total: "",
- };
- },
-
- methods: {
- tt() {},
- async fun3() {
- this.fun1().then((val) => {
- this.fun2();
- });
- },
- async fun4(tps) {
- this.fun1().then((val) => {
- for (let i = 0; i < this.issued_drug.length; i++) {
- if (tps == this.issued_drug[i].id) {
- this.$refs.table02.setCurrentRow(this.issued_drug[i]);
- this.handleCurrentChange(this.issued_drug[i]);
- }
- }
- });
- },
- async fun5(tps) {
- console.log("fun3", tps);
- this.fun1().then((val) => {
- for (let i = 0; i < this.waiting_drug.length; i++) {
- if (tps == this.waiting_drug[i].id) {
- this.$refs.table01.setCurrentRow(this.waiting_drug[i]);
- this.handleCurrentChange(this.waiting_drug[i]);
- }
- }
- });
- },
-
- // 单位去重
- unique_unit(arr) {
- return arr.filter(function (item, index, arr) {
- //当前元素,在原始数组中的第一个索引==当前索引值,否则返回当前元素
- return arr.indexOf(item, 0) === index;
- });
- },
- // 获取单位
- getDose_unit(val) {
- // console.log(val);
- var newLength = 0;
- var singleChar = "";
- var newStr = "";
- var chineseRegex = /[^\x00-\xff]/g;
- let strLength = val.replace(chineseRegex, "**").length;
- // console.log(strLength, "strLength");
- for (var i = 0; i < strLength; i++) {
- singleChar = val.charAt(i).toString();
- // console.log(singleChar,'singleChar')
- // console.log(singleChar.match(chineseRegex),'')
- if (singleChar.match(chineseRegex) != null) {
- newLength += 2;
- newStr += singleChar;
- } else {
- newLength++;
- }
- if (newLength > strLength) {
- break;
- }
- // newStr += singleChar;
- }
-
- // if (hasDot && strLength > len) {
- // newStr += "...";
- // }
- // console.log(newStr,'newStr')
- return newStr;
- },
-
- getSummaries_t1(param) {
- const { columns, data } = param;
- const sums = [];
- let dose_unit = [];
- let unit_1 = [];
- let unit_2 = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = "合计";
- return;
- }
- if (index === 7) {
- // 单位裁切
- data.forEach((el, index) => {
- dose_unit.push(this.getDose_unit(el.total));
- });
-
- dose_unit = this.unique_unit(dose_unit);
- console.log(dose_unit,'dose_unit')
- // // 数据合计
- data.forEach((el, index) => {
- if (this.getDose_unit(el.total) === dose_unit[0]) {
- unit_1.push(parseInt(el.total));
- }
- if (this.getDose_unit(el.total) === dose_unit[1]) {
- unit_2.push(parseInt(el.total));
- }
- });
- unit_1 = eval(unit_1.join("+"));
- unit_2 = eval(unit_2.join("+"));
-
- if (dose_unit[0] == undefined) {
- sums[index] = "";
- } else if (dose_unit[1] == undefined || unit_2 == undefined) {
- sums[index] = `${unit_1}${dose_unit[0]}`;
- } else {
- sums[index] = `${unit_1}${dose_unit[0]}+${unit_2}${dose_unit[1]}`;
- }
- return;
- }
- });
-
- return sums;
- },
-
- getSummaries_t2(param) {
- const { columns, data } = param;
- const sums = [];
- let dose_unit = [];
- let unit_1 = [];
- let unit_2 = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = "合计";
- return;
- }
- if (index === 6) {
- // 单位裁切
- data.forEach((el, index) => {
- dose_unit.push(this.getDose_unit(el.total));
- });
- dose_unit = this.unique_unit(dose_unit);
- // 数据合计
- data.forEach((el, index) => {
- if (this.getDose_unit(el.total) === dose_unit[0]) {
- unit_1.push(parseInt(el.total));
- }
- if (this.getDose_unit(el.total) === dose_unit[1]) {
- unit_1.push(parseInt(el.total));
- }
- });
- unit_1 = eval(unit_1.join("+"));
- unit_2 = eval(unit_2.join("+"));
-
- // sums[index] = unit_1+dose_unit[0]+ "+" +unit_2+dose_unit[1];
- if (dose_unit[0] == undefined) {
- sums[index] = "";
- } else if (dose_unit[1] == undefined || unit_2 == undefined) {
- sums[index] = `${unit_1}${dose_unit[0]}`;
- } else {
- sums[index] = `${unit_1}${dose_unit[0]}+${unit_2}${dose_unit[1]}`;
- }
- return;
- }
- });
- return sums;
- },
-
- changeTimes() {
- // alert("aa")
- // this.getdruglist();
- this.fun3();
- },
- //初始化
- init() {
- this.state = 1;
- this.tableData = null;
- this.currentRow = null;
- },
- lala() {
- this.currentRow = null;
- this.tableData = null;
- this.selectedbydefault();
- },
- searchAction() {
- // this.getlist();
- this.tableData = null;
- this.currentRow = null;
- this.getdruglist();
- },
- // 跳转打印页面
- toPrint() {
- if (this.state == 1 && this.multipleSelection.length == 0) {
- this.$message.error("未选择任何数据");
- return;
- }
- if (this.state == 2 && this.tableData == null) {
- this.$message.error("未选择任何数据");
- return;
- }
- this.$refs.drugprint.show(
- this.tableData,
- this.currentRow,
- this.state,
- this.multipleSelection,
- this.start_time
- );
- },
- toExport() {
- if (this.state == 1 && this.multipleSelection.length == 0) {
- this.$message.error("未选择任何数据");
- return;
- }
- if (this.state == 2 && this.tableData == null) {
- this.$message.error("未选择任何数据");
- return;
- }
- // for (let i = 0; i < this.tableData.length; i++) {
- // this.tableData[i].index = i + 1;
- // this.tableData[i].name = this.tableData[i].dose + this.tableData[i].dose_unit + "*" + this.tableData[i].min_number + this.tableData[i].min_unit +
- // "/" +
- // this.tableData[i].max_unit;
- //
- // this.tableData[i].total_price = (
- // this.tableData[i].warehousing_count * this.exportList[i].price
- // ).toFixed(2);
- // for (let j = 0; j < this.manufacturerList.length; j++) {
- // if (this.exportList[i].manufacturer == this.manufacturerList[j].id) {
- // this.exportList[i].manufacturer =
- // this.manufacturerList[j].manufacturer_name;
- // }
- // if (this.exportList[i].manufacturer == 0) {
- // this.exportList[i].manufacturer = "";
- // }
- // }
- //
- // for (let z = 0; z < this.dealerList.length; z++) {
- // if (this.exportList[i].dealer == this.dealerList[z].id) {
- // this.exportList[i].dealer = this.dealerList[z].dealer_name;
- // }
- // if (this.exportList[i].dealer == 0) {
- // this.exportList[i].dealer = "";
- // }
- // }
- // }
-
- if (this.state == 1) {
- import("@/vendor/Export2Excel").then((excel) => {
- for (let i = 0; i < this.multipleSelection.length; i++) {
- this.multipleSelection[i].index = i + 1;
- this.multipleSelection[i].time = this.start_time;
- this.multipleSelection[i].yname = this.currentRow.name;
- }
-
- const tHeader = [
- "序号",
- "时间",
- "患者名称",
- "药品名称",
- "单次用量",
- "用法",
- "频率",
- "天数",
- "总量",
- "数据来源",
- ];
- const filterVal = [
- "index",
- "time",
- "name",
- "yname",
- "single_dosage",
- "usage",
- "frequency",
- "days",
- "total",
- "data_sources",
- ];
-
- const data = this.formatJson(filterVal, this.multipleSelection);
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: "发药单详情",
- });
- this.downloadLoading = false;
- });
- } else if (this.state == 2) {
- import("@/vendor/Export2Excel").then((excel) => {
- for (let i = 0; i < this.tableData.length; i++) {
- this.tableData[i].index = i + 1;
- this.tableData[i].time = this.start_time;
- this.tableData[i].yname = this.currentRow.name;
- }
-
- const tHeader = [
- "序号",
- "日期",
- "患者名称",
- "药品名称",
- "单次用量",
- "用法",
- "频率",
- "天数",
- "总量",
- "数据来源",
- "领药人",
- ];
- const filterVal = [
- "index",
- "time",
- "name",
- "yname",
- "single_dosage",
- "usage",
- "frequency",
- "days",
- "total",
- "data_sources",
- "people",
- ];
-
- const data = this.formatJson(filterVal, this.tableData);
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: "发药单详情",
- });
- this.downloadLoading = false;
- });
- } else {
- this.$message.error("药品状态异常");
- return;
- }
- // import("@/vendor/Export2Excel").then((excel) => {
- // // for (let i = 0; i < this.tableData.length; i++) {
- // // for (let j = 0; j < this.drugTypeList.length; j++) {
- // // if (this.exportList[i].drug_type == this.drugTypeList[j].id) {
- // // this.exportList[i].drug_type = this.drugTypeList[j].name;
- // // }
- // // }
- // // }
- //
- // const tHeader = [
- // "序号",
- // "患者名称",
- // "单次用量",
- // "用法",
- // "频率",
- // "天数",
- // "总量",
- // "数据来源",
- // ];
- // const filterVal = [
- // "index",
- // "drug_name",
- // "drug_type",
- // "unit",
- // "batch_number",
- // "warehousing_count",
- // "price",
- // "total_price",
- // ];
- //
- // const data = this.tableData;
- // excel.export_json_to_excel({
- // header: tHeader,
- // data,
- // filename: "药品入库单详情",
- // });
- // this.downloadLoading = false;
- // });
- },
- formatJson(filterVal, jsonData) {
- return jsonData.map((v) => filterVal.map((j) => v[j]));
- },
- //列表选择与合计
- handleSelectionChange(val) {
- this.multipleSelection = val;
- let coculate = val;
- let sums = "";
- let dose_unit = [];
- let unit_1 = [];
- let unit_2 = [];
-
- coculate.forEach((el, index) => {
- // dose_unit.push(el.total.substr(el.total.length - 1, 1));
- dose_unit.push(this.getDose_unit(el.total))
- });
- dose_unit = this.unique_unit(dose_unit);
- // 数据合计
- coculate.forEach((el, index) => {
- if (this.getDose_unit(el.total) === dose_unit[0]) {
- unit_1.push(parseInt(el.total));
- }
- });
-
- coculate.forEach((el, index) => {
- if (this.getDose_unit(el.total) === dose_unit[1]) {
- unit_2.push(parseInt(el.total));
- }
- });
-
- unit_1 = eval(unit_1.join("+"));
- unit_2 = eval(unit_2.join("+"));
-
- if (dose_unit[0] == undefined) {
- sums = "";
- } else if (dose_unit[1] == undefined) {
- sums = `${unit_1}${dose_unit[0]}`;
- } else {
- sums = `${unit_1}${dose_unit[0]}+${unit_2}${dose_unit[1]}`;
- }
- // sums = `${unit_1}${dose_unit[0]}+${unit_2}${dose_unit[1]}`;
- this.select_total = sums;
- },
- //默认选中
- selectedbydefault() {
- if (this.state == 1 && this.waiting_drug.length > 0) {
- this.$refs.table01.setCurrentRow(this.waiting_drug[0]);
- this.handleCurrentChange(this.waiting_drug[0]);
- }
- if (this.state == 2 && this.issued_drug.length > 0) {
- this.$refs.table02.setCurrentRow(this.issued_drug[0]);
- this.handleCurrentChange(this.issued_drug[0]);
- }
- },
- //包装selectedbydefault
- fun2() {
- // return new Promise((resolve, reject) => {
- if (this.state == 1 && this.waiting_drug.length > 0) {
- this.$refs.table01.setCurrentRow(this.waiting_drug[0]);
- this.handleCurrentChange(this.waiting_drug[0]);
- }
- if (this.state == 2 && this.issued_drug.length > 0) {
- this.$refs.table02.setCurrentRow(this.issued_drug[0]);
- this.handleCurrentChange(this.issued_drug[0]);
- }
- // });
- },
- // 药品发药
- dispense() {
- var tps = this.currentRow.id;
- if (this.multipleSelection.length < 1) {
- this.$message.error("未选择任何信息");
- return;
- }
- var tmp = "";
- for (var i = 0; i < this.multipleSelection.length; i++) {
- tmp = tmp + this.multipleSelection[i].id + ",";
- }
- var params = {
- creater: this.admin_user_id,
- ids: tmp,
- };
- this.$confirm("确定是否对该药品进行发药?", "患者发药", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning",
- }).then(() => {
- medicinedeparture(params).then((res) => {
- if (res.data.state == 1) {
- this.$message.success("操作成功");
- this.getdruglist();
- //刷新列表
- this.handleCurrentChange(this.currentRow);
- this.fun4(tps);
- this.state = 2;
- this.multipleSelection = [];
- } else {
- this.$message.error("操作失败:" + res.data.msg);
- //刷新列表
- this.handleCurrentChange(this.currentRow);
- this.fun5(tps);
- this.state = 1;
- }
- });
- });
- },
- //获取药品列表
- getdruglist02() {
- // var tps = this.currentRow.id;
- this.tableData = [];
- var params = {
- keyword: this.keywords,
- time: this.start_time,
- deliveryway: this.deliveryway,
- };
- waitingmedicine(params).then((res) => {
- if (res.data.state == 1) {
- this.waiting_drug = res.data.data.list;
- }
- });
- dispensemedicine(params).then((res) => {
- if (res.data.state == 1) {
- this.issued_drug = res.data.data.list;
- }
- });
- if (this.state == 2) {
- this.handleCurrentChange(this.currentRow);
- // this.fun5(tps);
- } else {
- this.handleCurrentChange(this.currentRow);
- // this.fun4(tps);
- }
- },
- //获取药品列表
- getdruglist() {
- var params = {
- keyword: this.keywords,
- time: this.start_time,
- deliveryway: this.deliveryway,
- };
- waitingmedicine(params).then((res) => {
- if (res.data.state == 1) {
- this.waiting_drug = res.data.data.list;
- }
- });
- dispensemedicine(params).then((res) => {
- if (res.data.state == 1) {
- this.issued_drug = res.data.data.list;
- }
- });
- },
- async fun1() {
- var params = {
- keyword: this.keywords,
- time: this.start_time,
- deliveryway: this.deliveryway,
- };
- await waitingmedicine(params).then((res) => {
- if (res.data.state == 1) {
- this.waiting_drug = res.data.data.list;
- }
- });
- await dispensemedicine(params).then((res) => {
- if (res.data.state == 1) {
- this.issued_drug = res.data.data.list;
- }
- });
- console.log("fun1");
- },
-
- morencreatename() {
- var param = {};
- getcurrentname(param).then((res) => {
- if (res.data.state == 1) {
- this.admin_user_id = res.data.data.list;
- console.log("this.admin_user_id(药)", this.admin_user_id);
- }
- });
- },
- //获取领药人选项
- getlist() {
- var params = {
- start_time: this.start_time,
- keywords: this.keywords,
- };
- getTodayAdviceList(params).then((response) => {
- if (response.data.state == 1) {
- this.doctorList = response.data.data.doctorlist;
- // this.admin_user_id = this.doctorList[0].admin_user_id
- // this.admin_user_id = this.tmp
- }
- });
- },
- // //获取药品的患者信息
- informationofdrugs(val) {
- var params = {
- // patient_id: this.currentRow.
- };
- },
- handleCurrentChange(val) {
- this.currentRow = val;
- this.total = "";
- if (this.state == 1) {
- this.getdrugsdetails(0);
- }
- if (this.state == 2) {
- this.getdrugsdetails(1);
- }
- },
- getdrugsdetails(val) {
- if (this.state == 1) {
- val = 0;
- } else {
- val = 1;
- }
- var params = {
- drug_id: this.currentRow.id,
- is_medicine: val,
- time: this.start_time,
- shift: this.shift,
- partition: this.partition,
- deliveryway: this.deliveryway,
- };
- getpatientswithdrugs(params).then((res) => {
- if (res.data.state == 1) {
- this.tableData = res.data.data.list; //列表数据
- this.total = res.data.data.total; //合计
- } else {
- this.$message.error(res.data.msg);
- }
- });
- },
-
- toSetting() {
- getPharmacyConfig().then((response) => {
- if (response.data.state == 1) {
- this.dialogVisible = true;
- var config = response.data.data.config;
- this.is_open = config.is_open.toString();
- }
- });
- },
- SaveSetting() {
- var params = {
- is_open: parseInt(this.is_open),
- };
- SaveSetting(params).then((response) => {
- if (response.data.state == 1) {
- var config = response.data.data.config;
- this.$message.success("保存成功!");
- this.dialogVisible = false;
- }
- });
- },
- getrouteofadministration() {
- var params = {};
- routeofadministration(params).then((res) => {
- if (res.data.state == 1) {
- this.routeofadministration = res.data.data.list;
- }
- });
- },
- getgetpartitionlist() {
- var params = {};
- getpartitionlist(params).then((res) => {
- this.fen = res.data.data.list;
- });
- },
- getUserlist(drug_id) {
- var params = {
- start_time: this.start_time,
- drug_id: drug_id,
- };
- getUserdDrugList(params).then((response) => {
- if (response.data.state == 1) {
- var advicelist = response.data.data.advicelist;
- for (let i = 0; i < advicelist.length; i++) {
- advicelist[i].type = 1;
- advicelist[i].day = " ";
- this.tableList.push(advicelist[i]);
- }
- var hisAdviceList = response.data.data.hisAdviceList;
- for (let i = 0; i < hisAdviceList.length; i++) {
- hisAdviceList[i].type = 2;
- this.tableList.push(hisAdviceList[i]);
- }
- var patient = response.data.data.patient;
- this.patientList = patient;
- }
- });
- },
- },
- created() {
- this.init();
- this.morencreatename();
- this.getlist();
- // this.getdruglist();
- this.fun3();
- this.getrouteofadministration();
- this.getgetpartitionlist();
- },
- updated() {
- this.$nextTick(() => {
- if (this.$refs["table_01"]) {
- this.$refs["table_01"].doLayout();
- } else if (this.$refs["table_02"]) {
- this.$refs["table_02"].doLayout();
- }
- });
- },
- };
- </script>
-
- <style rel="stylesheet/css" lang="scss" scoped>
- .new-main-contain {
- height: 100%;
- display: flex;
- flex-direction: column;
- }
-
- .app-container {
- height: 100%;
- }
- .mainLeft {
- width: 300px;
- height: 100%;
- display: flex;
- flex-direction: column;
-
- .el-radio {
- margin-right: 75px;
- }
-
- .list {
- margin: 10px 0;
- }
- }
- .mainRight {
- margin-left: 10px;
- flex: 1;
- height: 100%;
- display: flex;
- flex-direction: column;
- overflow-y: hidden;
- .titlelist {
- display: flex;
- justify-content: space-between;
- white-space: nowrap;
- color: #909399;
- font-size: 14px;
-
- /deep/ .el-input__inner {
- font-size: 13px !important;
- }
- }
- .el-button {
- height: 34px;
- width: 65px;
- }
- .el-table {
- margin-top: -13px;
- }
- /deep/ .el-divider {
- height: 2px;
- margin-top: 10px;
- }
- }
-
- /deep/ .el-table--scrollable-x .el-table__body-wrapper {
- overflow-y: auto;
- overflow-x: hidden;
- }
- /deep/ .right_table {
- .el-table__body-wrapper {
- overflow-y: auto;
- overflow-x: scroll !important;
- }
- // /deep/ .el-table__footer-wrapper {
- // margin-top: -2px !important;
- // }
- }
- /deep/ .gutter {
- width: 15px !important;
- display: inline-block !important;
- }
- /deep/ .el-table__fixed-right-patch {
- width: 15px !important;
- }
-
- /deep/ .el-table__fixed-right {
- bottom: 0 !important;
- left: auto;
- right: 0;
- }
- /deep/ .el-table__body-wrapper::-webkit-scrollbar {
- width: 15px !important;
- height: 15px !important;
- }
- </style>
|