<template>
  <div class="layout_container" style="background-color: white">
    <header>
      <el-row>
        <el-col :span="14">
          打印份数
          <el-input-number
              v-model="printNum"
              :min="1"
              :max="10"
              size="small"
          />
          &nbsp;&nbsp;
          <el-select v-model="queryParam.type" size="small" style="width: 120px" @change="typeChange">
            <el-option
                label="结账"
                value="1"
            ></el-option>
            <el-option
                label="重打查询"
                value="2"
            ></el-option>
          </el-select>
          &nbsp;&nbsp;
          <el-date-picker v-if="queryParam.type === '2'" v-model="dateRange" type="daterange" range-separator="至" start-placeholder="开始日期" :clearable="false"
                @change="getClosingRecordList"    value-format="YYYY-MM-DD"      end-placeholder="结束日期" :shortcuts="shortcuts" style="width: 300px;margin-left: 3px"></el-date-picker>
          &nbsp;&nbsp;
          结账记录:<el-select v-if="queryParam.type === '2'" v-model="queryParam.code" style="width: 200px" @change="initAllData"  filterable>
            <el-option
                v-for="(item,index) in closingRecordList"
                :key="index"
                :label="item.opName"
                :value="index"
            >
              <span style="color: #8492a6; font-size: 12px">{{ item.opName }}</span>
              <el-divider direction="vertical"></el-divider>
              <span style="color: #8492a6; font-size: 12px">{{ item.closingDate }}</span>
            </el-option>
          </el-select>
        </el-col>
        <el-col :span="10">
          <el-button type="primary" icon="Search" @click="initAllData">查询</el-button>
          <el-button type="danger" icon="Delete" @click="clearAllData">清空</el-button>
          <el-button type="success" icon="Printer" @click="printData(false)">打印</el-button>
          <el-button v-if="queryParam.type==='1'" type="success" icon="Check" @click="dcountCharge">结账处理</el-button>
        </el-col>
      </el-row>
    </header>
    <div class="layout_main">
      <el-tabs v-model="activeName">
        <el-tab-pane label="日结报表" name="one">
          <div id="report_table"
               :style="style">
            <div id="report_table_1">
              <h2 style="text-align:center;font-weight: 700;">{{hosName}}住院结账统计日报表</h2>
              <div style="margin-top: 20px;">
                <span>收费员：</span><span id="username">{{zyDailyData.opName}}</span>
                <span style="margin-left: 120px;">工号：</span><span id="userIdCode">{{zyDailyData.opCodeRs}}</span>
                <span style="margin-left: 50px;"></span><span>结账时间：</span>
                <span v-if="queryParam.type === '1'" id="lastDailyDate">{{zyDailyData.lastDailyDate}}</span>
                <span v-if="queryParam.type === '1'">至</span>
                <span v-if="queryParam.type === '1'" id="currentDate">{{zyDailyData.currentDate}}</span>
                <span v-if="queryParam.type === '2'" id="currentDate">{{closeDate}}</span>
              </div>
              <table style="width: 96%;">
                <tbody>
                <tr>
                  <td rowspan="26" class="text-center" style="vertical-align: middle !important;">预<br>交<br>金
                  </td>
                  <td rowspan="9" class="text-center" style="vertical-align: middle !important;">收</td>
                  <td>类型</td>
                  <td>张数</td>
                  <td colspan="2">金额</td>
                  <td rowspan="26" class="text-center" style="vertical-align: middle !important;">结<br>算</td>
                  <td rowspan="9" class="text-center" style="vertical-align: middle !important;">补<br>款</td>
                  <td>类型</td>
                  <td colspan="3">金额</td>
                </tr>
                <tr>
                  <td>现金</td>
                  <td id="depositCashNum">{{zyDailyData.depositCashNum}}</td>
                  <td colspan="2" id="depositCashAmount">{{zyDailyData.depositCashAmount}}</td>
                  <td>现金</td>
                  <td colspan="3" id="jsbkCashAmount">{{zyDailyData.jsbkCashAmount}}</td>
                </tr>
                <tr>
                  <td>微信</td>
                  <td id="depositWxNum">{{zyDailyData.depositWxNum}}</td>
                  <td colspan="2" id="depositWxAmount">{{zyDailyData.depositWxAmount}}</td>
                  <td>微信</td>
                  <td colspan="3" id="jsbkWxAmount">{{zyDailyData.jsbkWxAmount}}</td>
                </tr>
                <tr>
                  <td>支付宝</td>
                  <td id="depositZfbNum">{{zyDailyData.depositZfbNum}}</td>
                  <td colspan="2" id="depositZfbAmount">{{zyDailyData.depositZfbAmount}}</td>
                  <td>支付宝</td>
                  <td colspan="3" id="jsbkZfbAmount">{{zyDailyData.jsbkZfbAmount}}</td>
                </tr>
                <tr>
                  <td>医保卡</td>
                  <td id="depositYbNum">{{zyDailyData.depositYbNum}}</td>
                  <td colspan="2" id="depositYbAmount">{{zyDailyData.depositYbAmount}}</td>
                  <td>医保卡</td>
                  <td colspan="3" id="jsbkYbAmount">{{zyDailyData.jsbkYbAmount}}</td>
                </tr>
                <tr>
                  <td>银联卡</td>
                  <td id="depositYlkNum">{{zyDailyData.depositYlkNum}}</td>
                  <td colspan="2" id="depositYlkAmount">{{zyDailyData.depositYlkAmount}}</td>
                  <td>银联卡</td>
                  <td colspan="3" id="jsbkYlkAmount">{{zyDailyData.jsbkYlkAmount}}</td>
                </tr>
                <tr>
                  <td>聚合支付</td>
                  <td id="depositJhzfNum">{{zyDailyData.depositJhzfNum}}</td>
                  <td colspan="2" id="depositJhzfAmount">{{zyDailyData.depositJhzfAmount}}</td>
                  <td>聚合支付</td>
                  <td colspan="3" id="jsbkJhzfAmount">{{zyDailyData.jsbkJhzfAmount}}</td>
                </tr>
                <tr>
                  <td>其他</td>
                  <td id="depositQtNum">{{zyDailyData.depositQtNum}}</td>
                  <td colspan="2" id="depositQtAmount">{{zyDailyData.depositQtAmount}}</td>
                  <td>其他</td>
                  <td colspan="3" id="jsbkQtAmount">{{zyDailyData.jsbkQtAmount}}</td>
                </tr>
                <tr>
                  <td>合计</td>
                  <td id="depositTotalNum">{{zyDailyData.depositTotalNum}}</td>
                  <td colspan="2" id="depositTotalAmount">{{zyDailyData.depositTotalAmount}}</td>
                  <td>合计</td>
                  <td colspan="3" id="jsbkTotalAmount">{{zyDailyData.jsbkTotalAmount}}</td>
                </tr>
                <tr>
                  <td rowspan="8" class="text-center" style="vertical-align: middle !important;">退</td>
                  <td>现金</td>
                  <td id="returnCashNum">{{zyDailyData.returnCashNum}}</td>
                  <td colspan="2" id="returnCashAmount">{{zyDailyData.returnCashAmount}}</td>
                  <td rowspan="8" class="text-center" style="vertical-align: middle !important;">退<br>款</td>
                  <td>现金</td>
                  <td colspan="3" id="jstkCashAmount">{{zyDailyData.jstkCashAmount}}</td>
                </tr>
                <tr>
                  <td>微信</td>
                  <td id="returnWxNum">{{zyDailyData.returnWxNum}}</td>
                  <td colspan="2" id="returnWxAmount">{{zyDailyData.returnWxAmount}}</td>
                  <td>微信</td>
                  <td colspan="3" id="jstkWxAmount">{{zyDailyData.jstkWxAmount}}</td>
                </tr>
                <tr>
                  <td>支付宝</td>
                  <td id="returnZfbNum">{{zyDailyData.returnZfbNum}}</td>
                  <td colspan="2" id="returnZfbAmount">{{zyDailyData.returnZfbAmount}}</td>
                  <td>支付宝</td>
                  <td colspan="3" id="jstkZfbAmount">{{zyDailyData.jstkZfbAmount}}</td>
                </tr>
                <tr>
                  <td>医保卡</td>
                  <td id="returnYbNum">{{zyDailyData.returnYbNum}}</td>
                  <td colspan="2" id="returnYbAmount">{{zyDailyData.returnYbAmount}}</td>
                  <td>医保卡</td>
                  <td colspan="3" id="jstkYbAmount">{{zyDailyData.jstkYbAmount}}</td>
                </tr>
                <tr>
                  <td>银联卡</td>
                  <td id="returnYlkNum">{{zyDailyData.returnYlkNum}}</td>
                  <td colspan="2" id="returnYlkAmount">{{zyDailyData.returnYlkAmount}}</td>
                  <td>银联卡</td>
                  <td colspan="3" id="jstkYlkAmount">{{zyDailyData.jstkYlkAmount}}</td>
                </tr>
                <tr>
                  <td>聚合支付</td>
                  <td id="returnJhzfNum">{{zyDailyData.returnJhzfNum}}</td>
                  <td colspan="2" id="returnJhzfAmount">{{zyDailyData.returnJhzfAmount}}</td>
                  <td>聚合支付</td>
                  <td colspan="3" id="jstkJhzfAmount">{{zyDailyData.jstkJhzfAmount}}</td>
                </tr>
                <tr>
                  <td>其他</td>
                  <td id="returnQtNum">{{zyDailyData.returnQtNum}}</td>
                  <td colspan="2" id="returnQtAmount">{{zyDailyData.returnQtAmount}}</td>
                  <td>其他</td>
                  <td colspan="3" id="jstkQtAmount">{{zyDailyData.jstkQtAmount}}</td>
                </tr>
                <tr>
                  <td>合计</td>
                  <td id="returnTotalNum">{{zyDailyData.returnTotalNum}}</td>
                  <td colspan="2" id="returnTotalAmount">{{zyDailyData.returnTotalAmount}}</td>
                  <td>合计</td>
                  <td colspan="3" id="jstkTotalAmount">{{zyDailyData.jstkTotalAmount}}</td>
                </tr>


                <tr>
                  <td rowspan="9" class="text-center" style="vertical-align: middle !important;">
                    收<br>退<br>合<br>计
                  </td>
                  <td>现金</td>
                  <td colspan="3" id="yjjsjhjCashAmount">{{zyDailyData.yjjsjhjCashAmount}}</td>
                  <td rowspan="9" class="text-center" style="vertical-align: middle !important;">
                    补<br>退<br>合<br>计
                  </td>
                  <td>现金</td>
                  <td colspan="3" id="jsbtCashAmount">{{zyDailyData.jsbtCashAmount}}</td>
                </tr>
                <tr>
                  <td>微信</td>
                  <td colspan="3" id="yjjsjhjWxAmount">{{zyDailyData.yjjsjhjWxAmount}}</td>
                  <td>微信</td>
                  <td colspan="3" id="jsbtWxAmount">{{zyDailyData.jsbtWxAmount}}</td>
                </tr>
                <tr>
                  <td>支付宝</td>
                  <td colspan="3" id="yjjsjhjZfbAmount">{{zyDailyData.yjjsjhjZfbAmount}}</td>
                  <td>支付宝</td>
                  <td colspan="3" id="jsbtZfbAmount">{{zyDailyData.jsbtZfbAmount}}</td>
                </tr>
                <tr>
                  <td>医保卡</td>
                  <td colspan="3" id="yjjsjhjYbkAmount">{{zyDailyData.yjjsjhjYbkAmount}}</td>
                  <td>医保卡</td>
                  <td colspan="3" id="jsbtYbkAmount">{{zyDailyData.jsbtYbkAmount}}</td>
                </tr>
                <tr>
                  <td>银联卡</td>
                  <td colspan="3" id="yjjsjhjYlkAmount">{{zyDailyData.yjjsjhjYlkAmount}}</td>
                  <td>银联卡</td>
                  <td colspan="3" id="jsbtYlkAmount">{{zyDailyData.jsbtYlkAmount}}</td>
                </tr>
                <tr>
                  <td>聚合支付</td>
                  <td colspan="3" id="yjjsjhjJhzfAmount">{{zyDailyData.yjjsjhjJhzfAmount}}</td>
                  <td>聚合支付</td>
                  <td colspan="3" id="jsbtJhzfAmount">{{zyDailyData.jsbtJhzfAmount}}</td>
                </tr>
                <tr>
                  <td>其他</td>
                  <td colspan="3" id="yjjsjhjQtAmount">{{zyDailyData.yjjsjhjQtAmount}}</td>
                  <td>其他</td>
                  <td colspan="3" id="jsbtQtAmount">{{zyDailyData.jsbtQtAmount}}</td>
                </tr>
                <tr>
                  <td>合计</td>
                  <td colspan="3" id="yjjsjhjHjAmount">{{zyDailyData.yjjsjhjHjAmount}}</td>
                  <td>合计</td>
                  <td colspan="3" id="jsbtHjAmount">{{zyDailyData.jsbtHjAmount}}</td>
                </tr>
                <tr>
                  <td>大写</td>
                  <td colspan="3" id="yjjsjhjHjAmountStr">{{zyDailyData.yjjsjhjHjAmountStr}}</td>
                  <td>大写</td>
                  <td colspan="3" id="jsbtHjAmountStr">{{zyDailyData.jsbtHjAmountStr}}</td>
                </tr>
                <tr>
                  <td rowspan="4" colspan="2" class="text-center" style="vertical-align: middle !important;">
                    上缴合计
                  </td>
                  <td>现金</td>
                  <td colspan="2" id="sjhjCashAmount">{{zyDailyData.sjhjCashAmount}}</td>
                  <td>微信</td>
                  <td colspan="3" id="sjhjWxAmount">{{zyDailyData.sjhjWxAmount}}</td>
                  <td>支付宝</td>
                  <td colspan="2" id="sjhjZfbAmount">{{zyDailyData.sjhjZfbAmount}}</td>
                </tr>
                <tr>
                  <td>医保卡</td>
                  <td colspan="2" id="sjhjYbkAmount">{{zyDailyData.sjhjYbkAmount}}</td>
                  <td>银联卡</td>
                  <td colspan="3" id="sjhjYlkAmount">{{zyDailyData.sjhjYlkAmount}}</td>
                  <td>转账</td>
                  <td colspan="2" id="zzAmount">{{zyDailyData.zzAmount}}</td>
                </tr>
                <tr>
                  <td>社保记账</td>
                  <td colspan="2" id="jzAmount">{{zyDailyData.jzAmount}}</td>
                  <td>包干返回</td>
                  <td colspan="3" id="totalByybdf">{{zyDailyData.totalByybdf}}</td>
                  <td>发票现金</td>
                  <td colspan="2" id="fpxjAmount">{{zyDailyData.fpxjAmount}}</td>
                </tr>
                <tr>
                  <td>聚合支付</td>
                  <td colspan="2" id="sjhjJhzfAmount">{{zyDailyData.sjhjJhzfAmount}}</td>
                  <td></td>
                  <td colspan="3" ></td>
                  <td></td>
                  <td colspan="2" ></td>
                </tr>
                <tr>
                  <td colspan="2">结算总金额</td>
                  <td colspan="3" id="totalCharge">{{zyDailyData.totalCharge}}</td>
                  <td>记账金额</td>
                  <td colspan="2" id="depositByjzAmount">{{zyDailyData.depositByjzAmount}}</td>
                  <td>发票张数</td>
                  <td id="fpCount">{{zyDailyData.fpCount}}</td>
                  <td>发票金额</td>
                  <td colspan="2" id="receiptAmount">{{zyDailyData.receiptAmount}}</td>
                </tr>
                </tbody>
              </table>
              <div  style="margin-bottom: 50px;">
                <table v-if="zyDailyData.refunfZyDepositFileList !=null && zyDailyData.refunfZyDepositFileList.length > 0" style="width: 96%;padding-left: 20px;"
                       id="sfzffpmx_table" >
                  <thead>
                  <tr>
                    <td colspan="9">预交金作废/退费：</td>
                  </tr>
                  <tr style="border-top:1px solid">
                    <td width="180px">住院号</td>
                    <td width="120px">金额</td>
                    <td width="100px">发票号</td>
                    <td width="180px">结算时间</td>
                    <td width="120px">收款方式</td>
                    <td width="100px">类型</td>
                  </tr>
                  </thead>
                  <tbody id="sfzffpmx">
                  <tr v-for="(item,index) in zyDailyData.refunfZyDepositFileList">
                    <td >{{item.inpatient_no}}</td>
                    <td >{{item.amount}}</td>
                    <td >{{item.receipt_no}}</td>
                    <td >{{getFormatDatetime(item.hs_time)}}</td>
                    <td >{{item.depo_type_name}}</td>
                    <td v-if="item.deleted == undefined ">退费</td>
                    <td v-else>作废</td>
                  </tr>
                  </tbody>
                </table>
              </div>
              <div style="font-weight: bold">
                <div>
                  <span>回收预交金：<span id="hsJe">{{zyDailyData.hsJe}}</span></span>
                </div>
                <div>
                  <span>预交金收据号：</span><span id="receiptNoBegin">{{zyDailyData.receiptNoBegin}}</span>至&nbsp;<span >{{zyDailyData.receiptNoEnd}}</span>
                </div>
                <div>
                  <span>结算收据号：</span><span id="jsReceiptNoBegin">{{zyDailyData.jsReceiptNoBegin}}</span><span v-if="zyDailyData.jsReceiptNoEnd !=null">至</span>
                  &nbsp;<span
                    id="jsReceiptNoEnd">{{zyDailyData.jsReceiptNoEnd}}</span>
                </div>
              </div>
              <div style="margin-top: 10px;"><span>结账人签字：</span><span style="text-decoration: underline" id="username_zbr">{{zyDailyData.opName}}</span><span
                  style="margin-left: 120px;">收款人签字：</span><span style="text-decoration: underline">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
                  style="margin-left: 120px;">审核人签字：</span><span style="text-decoration: underline">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
              </div>
            </div>
          </div>
        </el-tab-pane>
        <el-tab-pane label="发生预交金明细" name="two">
          <div class="layout_main layout_el-table">
            <el-table :data="chargeZyDepositFileList" border  style="width: 100%" stripe>
              <el-table-column align="center"  property="inpatient_no" label="住院号" />
              <el-table-column align="center"   property="name" label="姓名" />
              <el-table-column align="center"  property="ward_name" label="科别" />
              <el-table-column align="center"   property="receipt_no"  label="收据号" />
              <el-table-column align="center"   property="amount" label="金额" />
              <el-table-column align="center"   property="depo_type_name" label="收费方式" />
              <el-table-column align="center"   property="op_id_name" label="操作员" />
            </el-table>
          </div>
        </el-tab-pane>
        <el-tab-pane label="结算病人明细" name="third">
          <div class="layout_main layout_el-table">
            <el-table :data="zyChargeDetailList"  border  stripe>
              <el-table-column align="center"  property="inpatient_no" label="住院号" />
              <el-table-column align="center"   property="name" label="姓名" />
              <el-table-column align="center"  property="charge1" label="西药费" />
              <el-table-column align="center"   property="charge2"  label="中草药费" />
              <el-table-column align="center"   property="charge3" label="床位费" />
              <el-table-column align="center"   property="charge4" label="B 超" />
              <el-table-column align="center"   property="charge5" label="手术器械使用费" />
              <el-table-column align="center"   property="charge6" label="心电监护" />
              <el-table-column align="center"   property="charge7" label="体外反搏" />
              <el-table-column align="center"   property="charge8" label="电胸电图" />
              <el-table-column align="center"   property="charge9" label="心脑电图" />
              <el-table-column align="center"   property="charge10" label="麻醉费" />
              <el-table-column align="center"   property="charge11" label="透视照片" />
              <el-table-column align="center"   property="charge12" label="手术费" />
              <el-table-column align="center"   property="charge13" label="化验" />
              <el-table-column align="center"   property="charge14" label="输血" />
              <el-table-column align="center"   property="charge15" label="输氧" />
              <el-table-column align="center"   property="charge16" label="接生" />
              <el-table-column align="center"   property="charge17" label="护婴" />
              <el-table-column align="center"   property="charge18" label="ＣＴ" />
              <el-table-column align="center"   property="charge19" label="护理" />
              <el-table-column align="center"   property="charge20" label="陪护" />
              <el-table-column align="center"   property="charge21" label="理疗费" />
              <el-table-column align="center"   property="charge22" label="抢救" />
              <el-table-column align="center"   property="charge23" label="卫生处理" />
              <el-table-column align="center"   property="charge24" label="消毒" />
              <el-table-column align="center"   property="charge25" label="治疗费" />
              <el-table-column align="center"   property="charge26" label="其他" />
              <el-table-column align="center"   property="charge27" label="材料费" />
              <el-table-column align="center"   property="charge28" label="中成药费" />
              <el-table-column align="center"   property="total_charge" label="总费用" />
            </el-table>
          </div>
        </el-tab-pane>
        <el-tab-pane label="结算费用登记报表" name="fourth">
          <div class="layout_main layout_el-table">
            <el-table :data="jsfydjbb" border  style="width: 100%" stripe>
              <el-table-column align="center"  property="ward_name" label="病区" />
              <el-table-column align="center"   property="in_no" label="住院号" />
              <el-table-column align="center"  property="name" label="姓名" />
              <el-table-column align="center"   property="responce_type_name"  label="身份类型" />
              <el-table-column align="center"   property="admiss_date" label="入院日期" />
              <el-table-column align="center"   property="deposit" label="预交金" />
              <el-table-column align="center"   property="charge_bk" label="补款金额" />
              <el-table-column align="center"   property="charge_tk" label="退款金额" />
              <el-table-column align="center"   property="charge_self" label="自付金额" />
              <el-table-column align="center"   property="charge_jz" label="记账金额" />
              <el-table-column align="center"   property="total_charge" label="总金额" />
              <el-table-column align="center"   property="receipt_no" label="发票号" />
            </el-table>
          </div>
        </el-tab-pane>
        <el-tab-pane label="结算预交金明细" name="five">
          <div class="layout_main layout_el-table">
            <el-table :data="jsYjjDetailList" border  style="width: 100%" stripe>
              <el-table-column align="center"  property="inpatient_no" label="住院号" />
              <el-table-column align="center"   property="name" label="姓名" />
              <el-table-column align="center"  width="80" property="admiss_times" label="住院次数" />
              <el-table-column align="center"   property="receipt_no"  label="收据号" />
              <el-table-column align="center"   property="depo_amount" label="金额" />
              <el-table-column align="center"   property="op_id_name" label="操作员" />
            </el-table>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>

  </div>

</template>
<script setup >
import {
 queryHospitalName,
    dayClosing,
    getZyDailySettlementVo,
  queryZyDayclosingRecord
} from '@/api/zy-gl/zy-daily'
import {getWindowSize} from "@/utils/window-size";
import {onMounted} from "vue";
import {getLodop,initLodop} from "@/utils/c-lodop.js";
import { getFormatDatetime } from "@/utils/date"
import {shortcuts} from "@/data/shortcuts.js";
import {ElMessage} from "element-plus";
import {queryLastWindowsIpAddress} from "@/api/zy-gl/admission-registration.js";
const printNum = ref(1)
const hosName = ref('')
const dateRange = ref([])

const zyDailyData = ref({})
const jsYjjDetailList = ref([])
const chargeZyDepositFileList = ref([])
const zyChargeDetailList = ref([])
const jsfydjbb = ref([])

const clearAllData = ()=>{
  zyDailyData.value = {}
  jsYjjDetailList.value = []
  chargeZyDepositFileList.value = []
  zyChargeDetailList.value = []
  jsfydjbb.value = []
  printNum.value = 1
}

const queryParam = ref({
  dateStart:'',
  dateEnd:'',
  opId:'',
  type:'1',
  code:null,
})
//结账记录
const closingRecordList = ref([])
const closeDate = ref('')
const getClosingRecordList = ()=>{
  closingRecordList.value = []
  queryParam.value.code =null
  if(queryParam.value.type ==='2'){
    queryParam.value.dateStart = dateRange.value[0] +' 00:00:00'
    queryParam.value.dateEnd = dateRange.value[1] +' 23:59:59'
    queryZyDayclosingRecord(queryParam.value).then((res)=>{
      closingRecordList.value = res
    })
  }
}

const typeChange = ()=>{
  if(queryParam.value.type ==='1'){
    initAllData()
  }else {
    getClosingRecordList()
  }
}

const initAllData = ()=>{
  if(queryParam.value.type ==='2'){
    if(closingRecordList.value.length === 0 || closingRecordList.value[queryParam.value.code] == null){
       ElMessage.error('请选择结账记录');
      return
    }
    queryParam.value.dateStart = closingRecordList.value[queryParam.value.code].dateStart
    queryParam.value.dateEnd = closingRecordList.value[queryParam.value.code].dateEnd
    queryParam.value.opId = closingRecordList.value[queryParam.value.code].opId
    closeDate.value = closingRecordList.value[queryParam.value.code].closingDate
  }
  getZyDailySettlementVo(queryParam.value).then(res=>{
    zyDailyData.value = res
    jsYjjDetailList.value = res.jsYjjDetailList == null ? [] : res.jsYjjDetailList
    chargeZyDepositFileList.value = res.chargeZyDepositFileList == null ? [] : res.chargeZyDepositFileList
    zyChargeDetailList.value = res.zyChargeDetailList == null ? [] : res.zyChargeDetailList
    jsfydjbb.value = res.jsfydjbb == null ? [] : res.jsfydjbb
  })
}
onMounted(()=>{
  initLodop()
  queryHospitalName().then(res=>{
    hosName.value = res
  })
  dateRange.value=[getFormatDatetime(new Date(),'YYYY-MM-DD'),getFormatDatetime(new Date(),'YYYY-MM-DD')]
  initAllData()
  queryLastWindowsIpAddress().then(res=>{
    printCode.value = res.cgPrintIndex
  })
})

const dcountCharge = ()=>{
  dayClosing(zyDailyData.value.currentDate).then(re=>{
    printData(clearFlag)
  })
}

const printData = (clearFlag)=>{
  for (let i = 0; i < printNum.value; i++) {
    let LODOP = getLodop();
    LODOP.PRINT_INITA(6, 0, "210mm", "297mm", "住院收费收入日报表");
    LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
    //设置默认打印机
    LODOP.SET_PRINTER_INDEX(printCode.value);
    LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "210mm");
    LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "297mm");
    var strStyle = "<style>table{width: 96%;margin-top: 20px;margin-bottom: 10px;} table,td,th {border-width: 1px;border-style: solid;border-collapse: collapse}</style>";
    LODOP.ADD_PRINT_HTM("0mm", "5mm", "200mm", "280mm", strStyle + document.getElementById("report_table_1").innerHTML);
    LODOP.PREVIEW();
    if(clearFlag){
      clearAllData()
    }
    //LODOP.PRINT();
  }
}
const printCode = ref(-1)
const activeName = ref('one')
const style = ref({
  width: '920px',
  height: getWindowSize.value.h-120+'px',
  margin: '0 auto',
  border: '1px solid #337ab7',
  fontSize: '16px',
  padding: '40px 20px 40px 20px',
  overflowY:'auto',
})
</script>
<style scoped lang="scss">
#report_table  table,td,th {border-width: 1px;
  border-style: solid;
  border-collapse: collapse;
  padding: 8px;
}
</style>