123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- <template>
- <el-dialog
- title="打印"
- :visible.sync="visibility"
- :close-on-click-modal="isClose"
- :close-on-press-escape="isClose"
- >
- <el-button type="primary" @click="print" class="print_style"
- >打印</el-button
- >
- <div id="dialysis-print-box-1" class="dialysis-print-box-1">
- <div class="list_title" style="border-bottom:none;">
- <div style="width:100%;text-align:center;font-size:16px;font-weight:bold;">
- {{org_name}} <span v-if="state=='待发药'">发药单</span> <span v-if="state=='已发药'">领药单</span>
- </div>
- </div>
- <div style="display: flex;">
- <div style="margin-right: 20px;">日期:{{times}}</div>
- <div>单据号:00013756</div>
- </div>
- <div style="margin: 10px 0;">
- <!-- <span>床号:{{ }}</span>
- <span>住院号:{{DialysisNo}}</span> -->
- <span>姓名:{{name}}</span>
- <span>性别:{{ patients.gender==1 ?'男':'女'}}</span>
- <span>年龄:{{patients.age}}</span>
- <span>住院科室:肾内科</span>
- <!-- <span>入院诊断:{{patients.diagnose}}</span> -->
- <span>入院诊断:{{ getdiagnosis(diagnosis) }}</span>
- </div>
- <div>
- <table class="table" border="1"
- style="border-collapse: collapse;border-left: none;border-right: none;width: 100%;text-align: center;">
- <tr>
- <td>药品名称</td>
- <td>规格</td>
- <td>用量</td>
- <td>用法</td>
- <td>天数</td>
- <td>总量</td>
- <td>单价</td>
- <td>金额</td>
- <td>执行时间</td>
- </tr>
- <tr v-for="item in tableData" >
- <td>{{item.Name}}</td>
- <td>{{item.Spec}}</td>
- <td>{{item.SingleDosage}}</td>
- <td>{{item.Frequency}}</td>
- <td>{{ item.Days }}</td>
- <td>{{ item.Usage }}<span>{{item.Total}}</span></td>
-
- <td>{{item.Price}}</td>
- <td>{{item.Total_cost.toFixed(2)}}</td>
- <td>{{getTime(item.ExecutionTime) }}</td>
- </tr>
- </table>
- </div>
- <div style="display: flex;margin: 10px 0;">
- <div style="flex: 1;">发药药房:药房</div>
- <div style="flex: 1;">开单医生:{{Doctor}}</div>
- <div style="flex: 1;">金额合计:{{ Price_zong.toFixed(2) }}</div>
- </div>
- <div style="display: flex;">
- <div style="flex: 1;">调配人:{{getdoctors(tableData[0].ExecutionStaff) }}</div>
- <div style="flex: 1;">取药人:{{getdoctors(tableData[0].ExecutionStaff) }}</div>
- </div>
- <!-- <div>
- <div style="display: flex;">
- <div style="width: 30%;"></div>
- <div style="width: 30%;"></div>
- <div style="width: 30%;"></div>
- <div style="width: 30%;"></div>
- <div style="width: 30%;"></div>
- <div style="width: 30%;"></div>
- </div>
- </div> -->
- <!-- <div class="list_title">
- <div>患者名称:{{name}}</div>
- <div>发药状态:{{state}}</div>
- <div>日期:{{times}}</div>
- </div> -->
- </div>
- </el-dialog>
- </template>
- <script>
- import Vue from "vue";
- import print from "print-js";
- import printutils from "./print.js";
- import{todaynumber} from '@/api/pharmacy'
- const moment = require("moment");
- import { uParseTime } from "@/utils/tools";
- export default {
- data() {
- return {
- visibility: false,
- tableData: [],
- isClose:false,
- name:"",
- DialysisNo:'',
- state:null,
- times:"",
- start_time:moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
- org_name: this.$store.getters.xt_user.org.org_name,
- baseList:[],
- Doctor:'',
- patients:{},
- doctors:[],
- Price_zong:0,
- diagnosearr:[],
- diagnosis:'',
- };
- },
- props: {
- propForm: {
- type: Object,
- },
- },
- created(){
- this.init();
- },
- methods: {
- // isClose() {
- // this.visibility = false;
- // },
- init(){
- // let year = new Date().getFullYear();
- // let month = new Date().getMonth() +1;
- // let day = new Date().getDate();
- // let hour = new Date().getHours();
- // let minute = new Date().getMinutes();
- // this.times = year + "年" + month + "月" + day + "日" + hour + "时" + minute + "分"
- // console.log("times:",this.times)
- },
-
- hide: function () {
- this.visibility = false;
- for (let i = 0; i < this.propForm.goods.length; i++) {
- for (let key in this.propForm.goods[i]) {
- if (key != "index") {
- this.propForm.goods[i][key].isSelected = false;
- }
- }
- }
- },
- show: function (val,data,state,times,base,patients,doctors,arr,diagnosis) {
- this.times = times
- this.visibility = true;
- console.log("val111",val)
- console.log("val222",data)
- console.log("val333",base)
- console.log("val4444",patients)
-
- this.tableData = []
- for(let i =0; i < val.length;i++){
- if(val[i].Type == 1){
- this.tableData.push(val[i])
- }
- }
- this.Doctor = val[0].Doctor
- this.name = data.name
- this.DialysisNo = data.DialysisNo
- this.patients = patients
- this.doctors = doctors
- this.diagnosearr = arr
- this.diagnosis = diagnosis
- if (state == 1){
- this.state = "待发药"
- }
- if (state == 2){
- this.state = "已发药"
- }
- var Price_zong2 =0
- for(let i in this.tableData){
-
- const str = this.tableData[i].Total
- const num = str.replace(/[^\d]/g,"")
- // 每一行的金额
- this.tableData[i]['Total_cost'] = this.tableData[i].Price * num
- if(this.tableData[i].Price !=''){
- Price_zong2 = Price_zong2 + (this.tableData[i].Price * num)
- }
- }
- console.log('hhhhhhhh',this.tableData);
- this.Price_zong = Price_zong2
- },
- getdiagnosis(val){
- const diagnosis = val.split(',')
- console.log('diagnosis',diagnosis)
- const diagn = []
- // const dia_id =[]
- const arr = this.diagnosearr
- if(diagnosis.length>0 && arr.length>0){
- for(let i in arr){
- for(let j in diagnosis){
- if(arr[i].id ==diagnosis[j]){
- diagn.push(arr[i].class_name)
- }
- }
- var arr2 = diagn.join()
- console.log('arr2',arr2);
- }
- }
- return arr2
- },
- comfirm: function (formName) {
- this.goodInfo = [];
- this.goodInfoTableData = [];
- this.$emit("dialog-comfirm", this.getValue());
- this.$refs.multipleTable.clearSelection();
- this.$refs.table.setCurrentRow(null);
- },
- getValue() {},
-
- // 打印
- print() {
- console.log(this.org_name,'this.org_name')
- Vue.prototype.printJson = printutils.printJson;
- const style =
- '@media print {.list_title{width:940px;border-bottom:1px solid;display:flex;margin:20px auto} .table tr td{border:1px solid black;padding: 5px 0;border-left: none;border-right: none;}}';
- printJS({
- printable: "dialysis-print-box-1",
- type: "html",
- style: style,
- scanStyles: false,
- });
- // this.printJson({
- // title: `
- // <div>
- // <div style="width: 940px;text-align:center;font-size:16px;font-weight:bold;">${this.org_name} 发药单</div>
- // <div style="width: 940px;border-bottom: 1px solid;display: flex;margin: 30px auto;font-size:14px;">
- // <div style="width: 310px;padding: 10px 0;">患者名称:${this.name}</div>
- // <div style="width: 320px;padding: 10px 0;">发药状态:${this.state}</div>
- // <div style="width: 310px;padding: 10px 0;">日期:${this.times}</div>
- // </div></div>`, // 打印出来的标题
- // data: this.tableData, // 需要打印的数据
- // serial: true, // 是否需要打印序列号
- // fields: [
- // // 需要打印的字段
-
- // "Name",
- // "SingleDosage",
- // "Usage",
- // "Frequency",
- // "Days",
- // "Total",
- // "DataSources",
- // "Remarks",
- // ],
- // properties: [
- // // 需要打印的字段对应的表头名
-
- // {
- // field: "Name",
- // displayName: "名称",
- // },
- // {
- // field: "SingleDosage",
- // displayName: "单次用量",
- // },
- // {
- // field: "Usage",
- // displayName: "用法",
- // },
- // {
- // field: "Frequency",
- // displayName: "频率",
- // },
- // {
- // field: "Days",
- // displayName: "天数",
- // },
- // {
- // field: "Total",
- // displayName: "总量",
- // },
- // {
- // field: "DataSources",
- // displayName: "数据来源",
- // },
- // {
- // field: "Remarks",
- // displayName: "备注",
- // },
- // ],
- // });
- },
-
- getTime(val) {
- if(val < 0){
- return ""
- }
- if(val == ""){
- return ""
- }else {
- return uParseTime(val, '{y}-{m}-{d} {h}:{i}')
- }
- },
- getdoctors(id){
- for(let i in this.doctors){
- if(this.doctors[i].id == id){
- return this.doctors[i].user_name
- }
- }
- }
- },
- };
- </script>
-
- <style lang="scss" scoped>
- /deep/ .el-dialog{
- width: 60%;
- }
- /deep/ .el-table__body-wrapper::-webkit-scrollbar {
- width: 10px;
- height: 10px;
- }
- .print_style {
- position: absolute;
- right: 65px;
- top: 50px;
- }
-
- .list_title {
- width: 940px;
- border-bottom: 1px solid;
- display: flex;
- // margin: 30px auto;
-
- // div {
- // width: 320px;
- // padding: 10px 0;
- // }
- }
- .table tr td{
- border:1px solid black;
- padding: 5px 0;
- border-left: none;
- border-right: none;
- }
- </style>
-
- <style>
- .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
- font-size: 12px;
- }
-
- .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
- background: #6fb5fa;
- }
-
- .count {
- color: #bd2c00;
- }
- .el-table td,
- .el-table th.is-leaf,
- .el-table--border,
- .el-table--group {
- border-color: #d0d3da;
- }
- .el-table--border::after,
- .el-table--group::after,
- .el-table::before {
- background-color: #d0d3da;
- }
- </style>
|