123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605 |
- <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: 200px"
- v-model="start_time"
- type="date"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- placeholder="选择日期"
- @change="changeTimes()"
- >
- </el-date-picker>
- </div>
- <!-- <el-button @click="testsss">调试1</el-button>-->
- <!-- <el-button @click="testsss2">调试2</el-button>-->
- <div class="list">
- <el-radio-group v-model="state" @change="lala()">
- <el-radio :label="1">待发药{{ waitmount }}人</el-radio>
- <el-radio :label="2">已发药{{ alreadmount }}人</el-radio>
- </el-radio-group>
- </div>
- <div
- class="list"
- style="display: flex; justify-content: space-between"
- >
- <el-input
- size="small"
- style="width: 130px"
- v-model="keywords"
- class="filter-item"
- placeholder="请输入患者名称"
- clearable
- />
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- @click="searchAction"
- >搜索
- </el-button>
- </div>
-
- <el-table
- height="60vh"
- ref="table01"
- :data="waitmount_data"
- highlight-current-row
- @current-change="handleCurrentChange"
- border
- style="width: 100%"
- v-if="state == 1"
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266',
- }"
- >
- <el-table-column prop="date" label="患者姓名" width="100">
- <template slot-scope="scope">
- <span>{{ scope.row.name ? scope.row.name : "" }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="name" label="透析号" width="100">
- <template slot-scope="scope">
- <span>{{
- scope.row.dialysis_no ? scope.row.dialysis_no : ""
- }}</span>
- </template>
- </el-table-column>
- </el-table>
- <el-table
- :height="tableHeight"
- ref="table02"
- :data="alreadmount_data"
- highlight-current-row
- @current-change="handleCurrentChange"
- border
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266',
- }"
- style="width: 100%"
- v-if="state == 2"
- >
- <el-table-column prop="date" label="患者姓名" width="100">
- <template slot-scope="scope">
- <span>{{ scope.row.name ? scope.row.name : "" }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="name" label="透析号" width="100">
- <template slot-scope="scope">
- <span>{{
- scope.row.dialysis_no ? scope.row.dialysis_no : ""
- }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <div class="mainRight">
- <div class="titlelist">
- <div>
- 班次:
- <el-select
- v-model="shift"
- placeholder="请选择"
- @change="searchAction"
- >
- <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="searchAction"
- >
- <el-option
- v-for="item in fen"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </div>
-
-
- <div>
- <el-button type="primary" @click="toExport" v-if="state == 2"
- >导出</el-button
- >
-
- <el-button type="primary" @click="dispense" v-if="state == 1"
- >发药</el-button
- >
- <el-button type="primary" @click="endispense" v-if="state == 2"
- >退药</el-button
- >
- <el-button type="primary" @click="toPrint" v-if="printShow">打印</el-button>
- <!-- <el-button @click="tiaoshi">调试</el-button>-->
- <el-button type="primary" v-if="state == 1" @click="toSetting"
- >设置</el-button
- >
- </div>
- </div>
- <el-divider style="margin-top: 10px"></el-divider>
- <div>
- <el-table
- :height="tableHeight"
- :data="tableData"
- border
- style="width: 100%"
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266',
- }"
- >
- <el-table-column
- type="index"
- label="序号"
- width="50"
- align="center"
- >
- </el-table-column>
- <el-table-column label="名称" width="100" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.Name ? scope.row.Name : "" }}</span>
- </template>
- </el-table-column>
- <el-table-column label="规格" width="100" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.Spec}}</span>
- </template>
- </el-table-column>
- <el-table-column label="单次用量" width="100" align="center">
- <template slot-scope="scope">
- <span>{{
- scope.row.SingleDosage ? scope.row.SingleDosage : ""
- }}</span>
- </template>
- </el-table-column>
- <el-table-column label="用法" width="100" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.Usage ? scope.row.Usage : "" }}</span>
- </template>
- </el-table-column>
- <el-table-column label="频率" width="100" align="center">
- <template slot-scope="scope">
- <span>{{
- scope.row.Frequency ? scope.row.Frequency : ""
- }}</span>
- </template>
- </el-table-column>
- <el-table-column label="天数" width="100" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.Days ? scope.row.Days : "" }}</span>
- </template>
- </el-table-column>
- <el-table-column label="总量" width="100" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.Total ? scope.row.Total : "" }}</span>
- </template>
- </el-table-column>
- <el-table-column label="生产厂商" width="100" align="center">
- <template slot-scope="scope">
- <span>{{ (scope.row.MName) }}</span>
- </template>
- </el-table-column>
- <el-table-column label="药品追溯码" width="162" align="center">
- <template slot-scope="scope">
- <div @click="getDrugCode(scope.row.ID,scope.row.DataSources,scope.row.DrugCode,scope.$index,scope.row.DrugId,scope.row.Type)"><el-input style="width: 100;" v-model="scope.row.DrugCode"></el-input></div>
- </template>
- </el-table-column>
- <el-table-column label="开立医生" width="150" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.Doctor ? scope.row.Doctor : "" }}</span>
- </template>
- </el-table-column>
- <el-table-column label="数据来源" width="162" align="center">
- <template slot-scope="scope">
- <span>{{
- scope.row.DataSources ? scope.row.DataSources : ""
- }}</span>
- </template>
- </el-table-column>
- <el-table-column label="国家编码" width="162" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.Bm}}</span>
- </template>
- </el-table-column>
-
-
-
- <el-table-column align="center" width="100" label="拆零标志">
- <template slot-scope="scope">
- <el-select v-model="scope.row.ZeroFlag" placeholder="请选择" @change="changevalue(scope.row)">
- <el-option label="未知" value="0"></el-option>
- <el-option label="是" value="1"></el-option>
- <el-option label="否" value="2"></el-option>
- </el-select>
- </template>
- </el-table-column>
-
-
- <el-table-column label="备注" width="170" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.Remarks ? scope.row.Remarks : "" }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- <div v-if="state == 2" style="margin-top: 25px">诊断时间:{{ timedate }}</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>
- <span style="font-size: 17px">请选择是否发药时上传追溯码</span>
- <span style="display: block; padding: 18px 25px">
- <el-radio v-model="is_drug_open" label="1">是</el-radio>
- <el-radio v-model="is_drug_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>
-
- <el-dialog
- title="药品追溯码"
- @open="openDialog"
- :visible.sync="dialogVisibleOne"
- width="40%">
- <span>
- <div style="margin-bottom: 10px;">
- <span >追溯码个数:{{getTotal() }} 个</span>
- </div>
- <el-input
- ref="inputRef"
- @keyup.native="changeText"
- type="textarea"
- placeholder="请输入内容"
- v-model="textarea"
- autofocus
- :rows="10"
- >
- </el-input>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisibleOne = false">取 消</el-button>
- <el-button type="primary" @click="saveTextArea()">确 定</el-button>
- </span>
- </el-dialog>
-
-
- </div>
-
- <patient-print
- ref="patientprint"
- :visibility="isVisibility"
- :propsTable="propsTable"
-
- >
- </patient-print>
- <patientPrintTwo ref="patientprintTwo"
- :visibility="isVisibilityTwo"
- :propsTable="propsTable"
- >
- </patientPrintTwo>
- </div>
- </template>
-
- <script>
- import BreadCrumb from "@/xt_pages/components/bread-crumb";
- import patientPrint from "./print/patientPrint.vue";
- import patientPrintTwo from './print/patientPrintTwo'
- import { getPharmacyConfig, SaveSetting } from "@/api/his/advice";
- import {
- waitingdrug,
- issueddrugs,
- todaynumber,
- getpharmacycontent,
- dispensingmedicine,
- drugwithdrawal,
- getpartitionlist,
- changeDrugCode,
- changeZeroFlag,
- getDrugTocalCount
-
- } from "@/api/pharmacy";
- import dataDruguse from "../../router/modules/dataDruguse";
- import axios from 'axios'
- const moment = require("moment");
- export default {
- components: {
- BreadCrumb,
- patientPrint,
- patientPrintTwo
- },
- data() {
- return {
- patient_id: 0,
- crumbs: [
- { path: false, name: "药房管理" },
- { path: "/Pharmacy/patiantDispensing", name: "患者发药" },
- ],
- tableHeight: 400,
- start_time: moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
- start_time2: moment(new Date()).add("year", 0).format("YYYY-MM-DD HH:mm"),
- state: 1, //1待发药,2已发药
- waitmount: 0, //待发药人数
- waitmount_data: [],
- alreadmount: 0, //已发药人数
- alreadmount_data: [],
- keywords: "",
- tableData: [],
- propsTable: [],
- tableData_list: [],
- isVisibility: false,
- isVisibilityTwo:false,
- currentRow: null,
- dialogVisible: false,
- is_open: "2",
- banshift: [
- { value: 0, text: "全部班" },
- { value: 1, text: "上午" },
- { value: 2, text: "下午" },
- { value: 3, text: "晚上" },
- ],
- shift: 0, //班次
- fen: [],
- partition: 0, //分区
- drugList:[],
- baseList:[],
- org_id:'',
- patients:{},
- doctors:[],
- diagnosearr:[],
- diagnosis:'',
- dialogVisibleOne:false,
- textarea:"",
- id:0,
- is_source:0,
- drug_code:0,
- currentRow:{},
- currentIndex:0,
- is_drug_open:"2",
- textarea:"",
- patientList:[],
- drug_id:0,
- total_count:0,
- newArrList:[],
- textAreaList:[],
- scan_code:"",
- printShow:false,
- drug_type:1, //1是药品,2耗材
- };
- },
-
- created() {
- this.init();
- this.getgetpartitionlist();
- this.fun3();
- this.org_id = this.$store.getters.xt_user.org.id
- },
- methods: {
- getTotal(){
-
- if(this.textarea!=null){
- var textAreaList = this.textarea.split(",")
- // console.log("textArrleti",textAreaList)
- var arr = []
- if(textAreaList!=null && textAreaList.length>0){
- for(let i=0;i<textAreaList.length;i++){
- if(textAreaList[i]!=""){
- arr.push(textAreaList[i])
- }
- }
- return arr.length
- }else{
- return ""
- }
-
- }
-
- },
- openDialog(){
- this.$nextTick(() => {
- this.$refs.inputRef.focus()
- });
- },
- changevalue(row){
- var params = {
- id:row.ID,
- zero_flag:row.ZeroFlag,
- }
- changeZeroFlag(params).then(response=>{
- if(response.data.state == 1){
- this.$message.success("切换成功")
- }
- })
- },
- getgetpartitionlist() {
- var params = {};
- getpartitionlist(params).then((res) => {
- if (res.data.state == 1) {
- this.fen = res.data.data.list;
- this.is_drug_open = res.data.data.config.is_open
- }
- });
- },
- tiaoshi() {
- console.log("this.shift", this.shift);
- console.log("this.partition", this.partition);
- console.log("this.waitmount_data", this.waitmount_data);
- console.log("this.alreadmount_data", this.alreadmount_data);
- console.log("this.waitmount", this.waitmount);
- console.log("this.alreadmount", this.alreadmount);
- },
- async fun3() {
- this.fun1().then((val) => {
- this.fun2();
- });
- },
- async fun4(tmp) {
- console.log("fun3");
- this.fun1().then((val) => {
- console.log("this.alreadmount_data", this.alreadmount_data);
- for (let i = 0; i < this.alreadmount_data.length; i++) {
- console.log("tmp = ", tmp);
- if (this.alreadmount_data[i].PatientID == tmp) {
- console.log("i = ", i);
- this.$refs.table02.setCurrentRow(this.alreadmount_data[i]);
- this.handleCurrentChange(this.alreadmount_data[i]);
- }
- }
- });
- },
- async fun5(tmp) {
- console.log("fun5555");
- this.fun1().then((val) => {
- console.log("this.alreadmount_data", this.waitmount_data);
- for (let i = 0; i < this.waitmount_data.length; i++) {
- console.log("tmp = ", tmp);
- if (this.waitmount_data[i].PatientID == tmp) {
- console.log("i = ", i);
- this.$refs.table01.setCurrentRow(this.waitmount_data[i]);
- this.handleCurrentChange(this.waitmount_data[i]);
- }
- }
- });
- },
-
- lala() {
- console.log("this.state!!!!!!", this.state);
- //初始化状态
- this.tableData = null;
- this.currentRow = null;
- this.selectedbydefault();
- },
- //选中行数
- handleCurrentChange(val) {
- console.log("state--",this.state)
- this.currentRow = val;
- console.log("this.currentRow", this.currentRow);
-
- if (this.state == 1) {
- this.tableData = []
- this.patients = {}
- this.printShow = false
- this.getpatientdetails(0);
- }
- if (this.state == 2) {
- this.patients = {}
- this.tableData = []
- this.printShow = false
- this.getpatientdetails(1);
- }
- },
- init() {
- // console.log("初始化了")
- this.state = 1;
- this.tableData = null;
- this.currentRow = null;
- this.partition = 0;
- this.shift = 0;
- },
- testsss() {
- this.state = 1;
- },
- //默认选中的
- selectedbydefault() {
- if (this.state == 1 && this.waitmount_data.length > 0) {
- this.$refs.table01.setCurrentRow(this.waitmount_data[0]);
- this.handleCurrentChange(this.waitmount_data[0]);
- }
- if (this.state == 2 && this.alreadmount_data.length > 0) {
- this.$refs.table02.setCurrentRow(this.alreadmount_data[0]);
- this.handleCurrentChange(this.alreadmount_data[0]);
- }
- },
- //包装selectedbydefault
- fun2() {
- if (this.state == 1 && this.waitmount_data.length > 0) {
- this.$refs.table01.setCurrentRow(this.waitmount_data[0]);
- this.currentRow = this.waitmount_data[0]
- this.handleCurrentChange(this.waitmount_data[0]);
- console.log(" this.currentRow111")
- console.log( this.currentRow)
-
-
- }
- if (this.state == 2 && this.alreadmount_data.length > 0) {
- this.$refs.table02.setCurrentRow(this.alreadmount_data[0]);
- this.currentRow = this.alreadmount_data[0]
- this.handleCurrentChange(this.alreadmount_data[0]);
- console.log(" this.currentRow222")
- console.log( this.currentRow)
- }
- // });
- },
- changeTimes() {
- this.gettodaynumber();
- // this.getwaitmount();
- this.fun3();
- },
- //获取当天发药的人数
- gettodaynumber() {
- var params = {
- time: this.start_time,
- };
- todaynumber(params).then((res) => {
- if (res.data.state == 1) {
- console.log('3333333',res.data.data);
- this.waitmount = res.data.data.itotal;
- this.alreadmount = res.data.data.wtotal;
- this.drugList = res.data.data.drug
- this.is_drug_open = res.data.data.config.is_open
- }
- });
- // console.log("2222222")
- },
- //获取发药人列表
- getwaitmount() {
- var params = {
- keyword: this.keywords,
- time: this.start_time,
- shift: this.shift,
- partition: this.partition,
- };
-
- waitingdrug(params).then((res) => {
- if (res.data.state == 1) {
- this.waitmount_data=[]
- var list = res.data.data.list;
-
- if (this.shift != 0 || this.partition != 0) {
- if (this.waitmount_data == null) {
- this.waitmount = 0;
- } else {
- this.waitmount = this.waitmount_data.length;
- }
- }
- this.patientList = []
- this.patientList = res.data.data.patientList
- var listTwo = res.data.data.listTwo
-
- var newArr =[]
- if(listTwo!=null && listTwo.length>0){
- for(let i=0;i<listTwo.length;i++){
- listTwo[i].PatientID = 0
- listTwo[i].Name=""
- listTwo[i].DialysisNo=""
- listTwo[i].PatientID = listTwo[i].patient_id
- listTwo[i].Name = listTwo[i].patient.name
- listTwo[i].DialysisNo = listTwo[i].patient.dialysis_no
- newArr.push(listTwo[i])
- }
- }
-
- if(list!=null && list.length>0){
- for(let i=0;i<list.length;i++){
- this.waitmount_data.push(list[i])
- }
- if(newArr!=null && newArr.length>0){
- for(let i=0;i<newArr.length;i++){
- this.waitmount_data.push(newArr[i])
- }
- }
- }
- if(this.waitmount_data==null){
- if(newArr!=null && newArr.length>0){
- for(let i=0;i<newArr.length;i++){
- this.waitmount_data.push(newArr[i])
- }
- }
-
- }
- if(list==null){
- if(newArr!=null && newArr.length>0){
- for(let i=0;i<newArr.length;i++){
- this.waitmount_data.push(newArr[i])
- }
- }
-
- }
-
- }
- });
- issueddrugs(params).then((res) => {
- if (res.data.state == 1) {
- this.alreadmount_data =[]
- var list = res.data.data.list;
- var listTwo =res.data.data.listTwo
-
- if (this.shift != 0 || this.partition != 0) {
- if (list == null) {
- this.alreadmount = 0;
- } else {
- this.alreadmount = list.length;
- }
- }
-
- var newArr =[]
- if(listTwo!=null && listTwo.length>0){
- for(let i=0;i<listTwo.length;i++){
- listTwo[i].PatientID = 0
- listTwo[i].Name=""
- listTwo[i].DialysisNo=""
- listTwo[i].PatientID = listTwo[i].patient_id
- listTwo[i].Name = listTwo[i].patient.name
- listTwo[i].DialysisNo = listTwo[i].patient.dialysis_no
- newArr.push(listTwo[i])
- }
- }
-
- if(list!=null && list.length>0){
- for(let i=0;i<list.length;i++){
- this.alreadmount_data.push(list[i])
- }
- if(newArr!=null && newArr.length>0){
- for(let i=0;i<newArr.length;i++){
- this.alreadmount_data.push(newArr[i])
- }
- }
- }
- if(this.waitmount_data==null){
- if(newArr!=null && newArr.length>0){
- for(let i=0;i<newArr.length;i++){
- this.alreadmount_data.push(newArr[i])
- }
- }
-
- }
- if(list==null){
- if(newArr!=null && newArr.length>0){
- for(let i=0;i<newArr.length;i++){
- this.alreadmount_data.push(newArr[i])
- }
- }
-
- }
- }
- });
- },
- //包装getwaitmount
- async fun1() {
- var params = {
- keyword: this.keywords,
- time: this.start_time,
- shift: this.shift,
- partition: this.partition,
- };
- await waitingdrug(params).then((res) => {
- if (res.data.state == 1) {
- this.waitmount_data=[]
- this.patientList = []
- this.patientList = res.data.data.wait_patientList
- this.waitmount_data = this.patientList
- this.waitmount =this.waitmount_data.length
-
- }
- });
- await issueddrugs(params).then((res) => {
- if (res.data.state == 1) {
- this.alreadmount_data = []
- this.alreadmount_data = res.data.data.user_patientList
- this.alreadmount = this.alreadmount_data.length
- }
- });
-
- },
- getPatientName(patient_id){
- var name = ""
- for(let i=0;i<this.patientList.length;i++){
- if(patient_id == this.patientList[i].id){
- name = this.patientList[i].name
- }
- }
- return name
- },
- getPatientDialysisNo(patient_id){
- var dialysis_no = ""
- for(let i=0;i<this.patientList.length;i++){
- if(patient_id == this.patientList[i].id){
- dialysis_no = this.patientList[i].dialysis_no
- }
- }
- return dialysis_no
- },
- //获取患者信息详情
- getpatientdetails(val) {
- // const loading = this.$loading({
- // lock: true,
- // text: "Loading",
- // spinner: "el-icon-loading",
- // background: "rgba(0, 0, 0, 0.7)",
- // });
- console.log("val2332323223",this.currentRow)
- var params = {
- patient_id: this.currentRow.id,
- is_medicine: val,
- time: this.start_time,
- };
- getpharmacycontent(params).then((res) => {
- if (res.data.state == 1) {
- // loading.close()
-
- var list = res.data.data.list;
- console.log("hhhhawoowowow",res.data.data)
- this.baseList =[]
- this.baseList = res.data.data.baseList
- this.doctors = res.data.data.doctors
- this.diagnosearr = res.data.data.diagnose
- this.diagnosis = res.data.data.prescription.diagnosis
- const obj={
- age:res.data.data.patients.age,
- gender: res.data.data.patients.gender,
- diagnose:res.data.data.patients.diagnose,
- zhixing:res.data.data.patients.created_time
- }
- this.patients = {}
- this.patients =obj
- 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 ){
- this.tableData = []
- if(list!=null && list.length >0){
- for(let i=0;i<list.length;i++){
- if(list[i].DataSources != "临时医嘱"){
- this.tableData.push(list[i])
- }
- }
- }
-
- }
- 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 ){
- this.tableData = []
- this.tableData = list
- }
- this.printShow = true
- // console.log("tableDatawoowow",this.tableData)
- // loading.close()
- } else {
- this.$message.error(res.data.msg);
- }
- });
- },
- // 跳转打印页面
- toPrint() {
- console.log('10653',this.tableData);
-
- if (this.tableData == null) {
- this.$message.error("未选择任何数据");
- return;
- }else{
- if(this.org_id != 10653 && this.org_id !=0){
- this.$refs.patientprint.show(
- this.tableData,
- this.currentRow,
- this.state,
- this.start_time
- );
- }else{
- this.$refs.patientprintTwo.show(
- this.tableData,
- this.currentRow,
- this.state,
- this.start_time,
- this.baseList,
- this.patients,
- this.doctors,
- this.diagnosearr,
- this.diagnosis,
- )
- }
- }
-
-
-
- },
- toExport() {
- 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].uname = this.currentRow.Name;
- }
-
- const tHeader = [
- "序号",
- "日期",
- "患者名称",
- "名称",
- "单次用量",
- "用法",
- "频率",
- "天数",
- "总量",
- "开立医生",
- "数据来源",
- "备注",
- ];
- const filterVal = [
- "index",
- "time",
- "uname",
- "Name",
- "SingleDosage",
- "Usage",
- "Frequency",
- "Days",
- "Total",
- "Doctor",
- "DataSources",
- "Remarks",
- ];
-
- const data = this.formatJson(filterVal, 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]));
- },
-
- // 搜索患者
- searchAction() {
- this.tableData = null;
- this.fun3();
- // this.gettodaynumber();
- },
-
- // 药品发药
- dispense() {
- if (this.is_drug_open == 1){
- var that= this
- axios.get('http://127.0.0.1:9532/test/net',{}).then(function(response) {
- if (response.data.state == 0) {
- // that.$message.error(response.data.data.msg);
- that.$confirm("数据异常,请检查医保程序是否有打开", "提示", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning",
- }).then(() => {
-
- })
- .catch(() => {});
- return false
- } else {
- var tmp = that.currentRow.PatientID;
- console.log(that.currentRow)
- var params = {
- patient_id: that.currentRow.PatientID,
- time: that.start_time,
- admin_user_id: that.$store.getters.xt_user.user.id,
- };
- that.$confirm("确定是否对该患者进行发药?", "患者发药", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning",
- }).then(() => {
- dispensingmedicine(params).then((res) => {
- if (res.data.state == 1) {
- that.$message.success("操作成功");
- that.gettodaynumber();
- that.searchAction();
- that.tableData = null;
- that.fun4(tmp);
- that.state = 2;
- //进行追溯码上传
- axios.get('http://127.0.0.1:9532/api/changedrug/four', {
- params:params
- })
- .then(function(response) {
- if (response.data.state == 0) {
- that.$message.error(response.data.msg)
- return false
- } else {
- if (response.data.data.failed_code == -10) {
- that.$confirm(response.data.data.msg, '医保错误信息', {
- confirmButtonText: '确 定',
- type: 'warning'
- }).then(() => {
-
- }).catch(() => {
- })
- } else {
- if(response.data.data.msg.length > 0){
- that.$confirm(response.data.data.msg, '上传信息', {
- confirmButtonText: '确 定',
- type: 'warning'
- }).then(() => {
-
- }).catch(() => {
- })
- }
- }
- }
- })
- .catch(function(error) {
- })
- } else {
- that.$message.error(res.data.msg);
- }
- });
- })
- .catch(() => {});
- }
- }).catch(function(error) {
- that.$confirm("数据异常,请检查医保程序是否有打开", "提示", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning",
- }).then(() => {
- })
- .catch(() => {});
- })
-
- }else{
- var tmp = this.currentRow.id;
- console.log(this.currentRow)
-
- var params = {
- patient_id: this.currentRow.id,
- time: this.start_time,
- };
- this.$confirm("确定是否对该患者进行发药?", "患者发药", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning",
- }).then(() => {
- dispensingmedicine(params).then((res) => {
- if (res.data.state == 1) {
- this.$message.success("操作成功");
- this.gettodaynumber();
- this.searchAction();
- this.tableData = null;
- this.fun4(tmp);
- this.state = 2;
-
-
- } else {
- this.$message.error(res.data.msg);
- }
- });
- })
- .catch(() => {});
- }
-
-
-
- },
-
- 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();
- var codeConfig = response.data.data.codeConfig
- this.is_drug_open = codeConfig.is_open.toString()
- }
- });
- },
- SaveSetting() {
- var params = {
- is_open: parseInt(this.is_open),
- is_drug_open:parseInt(this.is_drug_open)
- };
- SaveSetting(params).then((response) => {
- if (response.data.state == 1) {
- var config = response.data.data.config;
- this.$message.success("保存成功!");
-
- this.dialogVisible = false;
- }
- });
- },
- // 药品退药
- endispense() {
- if (this.is_drug_open == 1){
- var that= this
- axios.get('http://127.0.0.1:9532/test/net',{}).then(function(response) {
- if (response.data.state == 0) {
- // that.$message.error(response.data.data.msg);
- that.$confirm("数据异常,请检查医保程序是否有打开", "提示", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning",
- }).then(() => {
-
- })
- .catch(() => {
-
- });
- return false
- } else {
- var tmp = that.currentRow.id;
- var params = {
- patient_id: that.currentRow.id,
- admin_user_id: that.$store.getters.xt_user.user.id,
- time: that.start_time,
- };
- that.$confirm("确定是否对该患者进行退药?", "患者退药", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning",
- }).then(() => {
- drugwithdrawal(params).then((res) => {
- if (res.data.state == 1) {
- that.$message.success("操作成功");
- that.gettodaynumber();
- that.searchAction();
- that.tableData = null;
- that.fun5(tmp);
- that.state = 1;
-
- //进行追溯码上传
- axios.get('http://127.0.0.1:9532/api/delete_xs_bg_two', {
- params:params
- })
- .then(function(response) {
- if (response.data.state == 0) {
- that.$message.error(response.data.msg)
- return false
- } else {
- if (response.data.data.failed_code == -10) {
- that.$confirm(response.data.data.msg, '医保错误信息', {
- confirmButtonText: '确 定',
- type: 'warning'
- }).then(() => {
-
- }).catch(() => {
- })
- } else {
- if(response.data.data.msg.length > 0){
- that.$confirm(response.data.data.msg, '上传信息', {
- confirmButtonText: '确 定',
- type: 'warning'
- }).then(() => {
-
- }).catch(() => {
- })
- }
- }
- }
- })
- .catch(function(error) {
- })
-
- } else {
- that.$message.error(res.data.msg);
- }
- });
- })
- .catch(() => {});
-
- }
- }).catch(function(error) {
- that.$confirm("数据异常,请检查医保程序是否有打开", "提示", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning",
- }).then(() => {
- })
- .catch(() => {});
- })
- }else{
- var tmp = this.currentRow.id;
- var params = {
- patient_id: this.currentRow.id,
- time: this.start_time,
- };
- this.$confirm("确定是否对该患者进行退药?", "患者退药", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning",
- }).then(() => {
- drugwithdrawal(params).then((res) => {
- if (res.data.state == 1) {
- this.$message.success("操作成功");
- this.gettodaynumber();
- this.searchAction();
- this.tableData = null;
- this.fun5(tmp);
- this.state = 1;
-
-
- } else {
- this.$message.error(res.data.msg);
- }
- });
- })
- .catch(() => {});
-
- }
-
- },
- getDrugName(drug_id){
-
- var medical_insurance_number = ""
- for(let i=0;i<this.drugList.length;i++){
- if(drug_id == this.drugList[i].id){
- medical_insurance_number = this.drugList[i].medical_insurance_number
- }
- }
- return medical_insurance_number
- },
- getManutuer(drug_id){
- var manufacturer_name = ""
- for(let i=0;i<this.baseList.length;i++){
- if(drug_id == this.baseList[i].id){
- manufacturer_name = this.baseList[i].manufacturer_name
- }
- }
- return manufacturer_name
- },
- getSpecaiName(drug_id){
- var spc =""
- for(let i=0;i<this.baseList.length;i++){
- if(drug_id == this.baseList[i].id){
- 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
- }
- }
- return spc
- },
- getDrugCode(id,DataSources,DrugCode,index,DrugId,type){
- this.drug_type = type
- console.log("type---------------",type)
- console.log( this.drug_type)
- if (type == 1){
- // 针对百霖
- if(this.$store.getters.xt_user.org.id == 10138 || this.$store.getters.xt_user.org.id == 10278 || this.$store.getters.xt_user.org.id == 10610 || this.$store.getters.xt_user.org.id == 10537 || this.$store.getters.xt_user.org.id==0|| this.$store.getters.xt_user.org.id==10726){
- var params = {
- drug_id:DrugId,
- start_time:moment().subtract(15, 'days').format("YYYY-MM-DD")
- }
- getDrugTocalCount(params).then(response=>{
- if(response.data.state == 1){
- var adviceList = response.data.data.adviceList
- var drug = response.data.data.drug
- this.scan_code = drug.scan_code
- var str = ""
- if(adviceList!=null && adviceList.length>0){
- for(let i=0;i<adviceList.length;i++){
- if(adviceList[i].drug_code!=""){
- str+=adviceList[i].drug_code
- }
- }
- }
- var new_arr = str.split(",");
-
- console.log("adviceList==========",new_arr)
-
- if(new_arr!=null && new_arr.length>0){
-
- let dataInfo = {}
- new_arr.forEach((item, index) => {
- if (!dataInfo[item]) {
- dataInfo[item] = {
- drug_code:item,
- child: [],
- }
- }
- })
- let arr = Object.values(dataInfo)
-
- if(arr!=null && arr.length>0){
-
- for(let i=0;i<arr.length;i++){
- for(let j=0;j<new_arr.length;j++){
- if(arr[i].drug_code == new_arr[j]){
- arr[i].child.push(new_arr[j])
- }
- }
- }
- }
-
- this.newArrList = []
- this.newArrList = arr
- console.log("newARRlIST----------",this.newArrList)
- }
-
- this.drug_id = DrugId
- this.id = id
- var is_source =0
- if (DataSources == "his处方"){
- is_source = 1
- }
- if (DataSources == "临时医嘱"){
- is_source = 2
- }
- this.is_source = is_source
- this.textarea = DrugCode
- this.currentIndex = index
-
- this.dialogVisibleOne = true
- }
- })
- }else{
-
- this.drug_id = DrugId
- this.id = id
- var is_source =0
- if (DataSources == "his处方"){
- is_source = 1
- }
- if (DataSources == "临时医嘱"){
- is_source = 2
- }
- this.is_source = is_source
- this.textarea = DrugCode
- this.currentIndex = index
- this.dialogVisibleOne = true
- }
- this.$nextTick(()=>{
- this.$refs.inputRef.focus()
- })
-
- }else{
- this.drug_id = DrugId
- this.id = id
- this.is_source = 3
- this.textarea = DrugCode
- this.currentIndex = index
- this.dialogVisibleOne = true
-
- }
-
- },
- saveTextArea(){
- var params = {
- id:this.id,
- data_source:this.is_source,
- drug_code:this.textarea,
- }
- console.log("paramss",params)
-
- changeDrugCode(params).then(response=>{
- if(response.data.state == 1){
- this.$message.success("保存成功!")
- for(let i=0;i<this.tableData.length;i++){
- if(this.currentIndex == i){
- this.tableData[i].DrugCode = this.textarea
- }
- }
- this.dialogVisibleOne = false
- }
- })
- },
- changeText(event){
- if(this.drug_type == 1){ //药品
- // 检查是否为特定的按键,例如回车键,来确认扫码枪输入完成
- if (event.key === 'Enter') {
-
- var textarea = ""
- textarea += this.textarea.replace(/^\s*[\r\n]|\r?\n\s*$/gm, '') + ","
- // var textAreaList = this.textarea.split(",")
- // var textarea = ""
- // textarea += this.textarea.replace(/^\s*[\r\n]|\r?\n\s*$/gm, '') + ","
- // var parts = textarea.split(',')
- // for(let i=0;i<textAreaList.length;i++){
- // if(parts[parts.length-2] == textAreaList[i]){
- // this.$message.error("该条码已经存在,不能重复扫码")
- // }
- // }
-
- // const uniqueStr = [...new Set(textarea.split(','))].join(',');
-
- // var textarea = uniqueStr
-
-
- if(this.$store.getters.xt_user.org.id == 10138 || this.$store.getters.xt_user.org.id == 10278|| this.$store.getters.xt_user.org.id == 10537 || this.$store.getters.xt_user.org.id == 10610 || this.$store.getters.xt_user.org.id == 10726){
-
- var drugindentificaitoncode = this.getDrugIdentificationCode(this.drug_id)
- var total_one = 0
- var total_two = 0
-
- var arr= []
- arr = textarea.split(",")
- var arrList = []
- if(arr!=null && arr.length>0){
- let dataInfo = {}
- arr.forEach((item, index) => {
- if (!dataInfo[item]) {
- dataInfo[item] = {
- drug_code:item,
- child: [],
- }
- }
- })
- let new_arr = Object.values(dataInfo)
-
- if(new_arr!=null && new_arr.length>0){
-
- for(let i=0;i<new_arr.length;i++){
- for(let j=0;j<arr.length;j++){
- if(new_arr[i].drug_code == arr[j]){
- new_arr[i].child.push(arr[j])
- }
- }
- }
- }
- arrList = new_arr
-
- }
-
- var is_err_check = false
- var i_index = ""
- var drug_code = ""
-
- if(arr!=null && arr.length>0){
- for(let i=0;i<arr.length;i++){
-
- if(arr[i]!=""){
- drug_code = arr[i]
- i_index = i
- if(arr[i].length!=20){
- this.$message.error("药品追溯码长度没有满足20位!")
- is_err_check = true
- }
-
-
- if(this.$store.getters.xt_user.org.id != 10726){
- if(drugindentificaitoncode>0){
- if(arr[i].substring(0,7)!= drugindentificaitoncode){
- this.$message.error("药品标识码格式不正确,请重新扫码")
- is_err_check = true
- }
- }
- }
-
-
-
-
- }
-
- }
- }
- if(is_err_check == true){
- arr.splice(i_index,1)
- }
-
- for(let i=0;i<this.newArrList.length;i++){
- if(drug_code == this.newArrList[i].drug_code){
- total_one = this.newArrList[i].child.length
- }
- }
-
- for(let i=0;i<arrList.length;i++){
- if(drug_code == arrList[i].drug_code){
- total_two = arrList[i].child.length
- }
- }
-
-
- console.log("数量1--------------",total_one)
- console.log("数量2---------------",total_two)
-
-
-
- if(this.scan_code>0){
- if((total_one + total_two)>this.scan_code){
- this.$message.error("扫码次数已经超过限制!")
- arr.splice(i_index,1)
- }
- }
-
- var is_arr = this.hasDuplicates(arr)
-
- this.textarea = arr.join(",")
- }else{
- // console.log("haaaaaaaaaaaaaaaaaaa",textarea)
-
- var arr = textarea.split(",");
-
- var lastElement = arr[arr.length - 2];
-
- if(lastElement.length!=20){
- this.$message.error("药品追溯码长度没有满足20位!")
- arr.splice(arr.length-2,1)
- }
- console.log("arr-------------",arr)
-
- this.textarea = ""
- this.textarea = arr.join(",")
-
- // this.textarea = textarea
- }
- }
- }else{ //耗材
- if (event.key === 'Enter') {
- var textarea = ""
- textarea += this.textarea + ","
- this.textarea = textarea
- }
- }
- this.getTotal()
- },
-
- hasDuplicates(arr) {
- const uniqueNumbers = [...new Set(arr)];
- return uniqueNumbers.length !== arr.length;
- },
- getDrugIdentificationCode(id){
-
- var drug_identification_code = ""
- for(let i=0;i<this.baseList.length;i++){
- if(id == this.baseList[i].id){
- drug_identification_code = this.baseList[i].drug_identification_code
- }
- }
- return drug_identification_code
- },
-
- },
- watch:{
-
- }
-
- };
- </script>
-
- <style rel="stylesheet/css" lang="scss" scoped>
- .new-main-contain {
- height: 100%;
- display: flex;
- flex-direction: column;
- }
-
- .app-container {
- height: 100%;
- }
- .mainLeft {
- width: 200px;
- height: 100%;
- display: flex;
- flex-direction: column;
-
- .el-radio {
- margin-right: 5px;
- }
-
- .list {
- margin: 10px 0;
- }
- }
- .mainRight {
- margin-left: 10px;
- flex: 1;
- height: 100%;
- display: flex;
- flex-direction: column;
- overflow-y: auto;
- .titlelist {
- display: flex;
- justify-content: space-between;
- white-space: nowrap;
- color: #909399;
- font-size: 14px;
- /deep/ .el-input__inner {
- font-size: 13px !important;
- }
- }
- .el-table {
- margin-top: -13px;
- }
- .el-button {
- height: 34px;
- width: 65px;
- }
- /deep/ .el-divider {
- height: 2px;
- margin-top: 10px;
- }
-
- /deep/ .el-table__body-wrapper {
- overflow-x: scroll !important;
- }
- }
-
- /deep/ .el-input__inner {
- padding-right: 15px;
- }
-
- /deep/ .el-table--scrollable-x .el-table__body-wrapper {
- overflow: auto;
- overflow-x: hidden;
- }
- /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>
|