<template>
  <div id="allList-print" class="allList-print">
    <table
      class="listTable"
      border="0"
      cellspacing="0"
      style="font-size: 14px"
      align="center"
    >
      <THEAD
        style="
          display: table-header-group;
          font-weight: bold;
        "
      >
        <TR>
          <TD colspan="3" align="center" style="font-size: 20px">
            {{ $store.getters.xt_user.org.org_name }}费用清单
          </TD>
        </TR>
        <TR>
          <TD colspan="1">患者姓名：{{ patient.name }}</TD>
          <TD>性别：{{ patient.gender == 1 ? "男" : "女" }}</TD>
          <TD
            >结算类型：{{
              order.is_medicine_insurance == 1 ? "医保" : "自费"
            }}</TD
          >
        </TR>
        <TR>
          <TD> 住院/门诊号：{{ order.mdtrt_id }} </TD>
          <TD>科室：血透 </TD>
          <TD>就诊流水号：{{ order.mdtrt_id }}</TD>
        </TR>
        <TR>
          <TD> 总费用：{{ order.medfee_sumamt }} </TD>
          <TD>个人支付：{{ order.psn_part_amt }} </TD>
          <TD>基金支付记账：{{ order.fund_pay_sumamt }}</TD>
        </TR>
        <TR>
          <TD>补充医疗支付记账：0.00</TD>
          <TD>救助支付金额：{{ order.maf_pay }}</TD>
          <TD></TD>
        </TR>
      </THEAD>

      <TBODY style="text-align: center">
        <TR>
          <TD colspan="3">
            <Table class="allListTable" border="1">
              <TR>
                <TD style="width: 5%">序号</TD>
                <TD style="width: 15%">处方日期</TD>
                <TD style="width: 10%">费用编号</TD>
                <TD style="width: 40%">费用名称</TD>
                <TD style="width: 5%">单位</TD>
                <TD style="width: 5%">数量</TD>
                <TD style="width: 10%">单价</TD>
                <TD style="width: 10%">金额</TD>
              </TR>
              <template v-for="(item, index) in list">
                <tr v-if="item.is_total == 0">
                  <td style="width: 5%">{{ index + 1 }}</td>
                  <td style="width: 15%">{{ item.p_time }}</td>
                  <td style="width: 10%">
                    {{ item.feedetl_sn.split("-")[2] }}
                  </td>
                  <td style="width: 30%; white-space: nowrap; overflow: hidden">
                    {{ item.name }}{{ item.spec }}
                  </td>
                  <td style="width: 5%">{{ item.unit }}</td>
                  <td style="width: 5%; text-align: right">{{ item.count }}</td>
                  <td style="width: 10%; text-align: right">
                    {{ item.price }}
                  </td>
                  <td style="width: 10%; text-align: right">
                    {{ (item.price * item.count).toFixed(2) }}
                  </td>
                </tr>
                <tr v-if="item.is_total == 1">
                  <td style="width: 5%"></td>
                  <td style="width: 15%"></td>
                  <td style="width: 10%"></td>
                  <td style="width: 30%; white-space: nowrap; overflow: hidden">
                    {{ item.name }}
                  </td>
                  <td style="width: 5%"></td>
                  <td style="width: 5%"></td>
                  <td style="width: 10%; text-align: right"></td>
                  <td style="width: 10%; text-align: right">
                    {{ item.price }}
                  </td>
                </tr>
              </template>
            </Table>
          </TD>
        </TR>
      </TBODY>
    </table>
    <!-- <div class="allListTitle">
      
    </div> -->
    <!-- <div class="allListInfo">
      <div style="text-align: left">患者姓名：{{ patient.name }}</div>
      <div style="text-align: left; padding-left: -20px">
        性别：{{ patient.gender == 1 ? "男" : "女" }}
      </div>
      <div style="text-align: left">
        结算类型：{{ order.is_medicine_insurance == 1 ? "医保" : "自费" }}
      </div>
    </div> 

     <div class="allListInfo">
      <div style="text-align: left">住院/门诊号：{{ order.mdtrt_id }}</div>
      <div style="text-align: left">科室：血透</div>
      <div style="text-align: left">就诊流水号：{{ order.mdtrt_id }}</div>
    </div>

    <div class="allListInfo">
      <div style="text-align: left">总费用：{{ order.medfee_sumamt }}</div>
      <div style="text-align: left">个人支付：{{ order.psn_part_amt }}</div>
      <div style="text-align: left">
        基金支付记账：{{ order.fund_pay_sumamt }}
      </div>
    </div> 

    <div class="allListInfo">
      <div style="text-align: left">补充医疗支付记账：0.00</div>
      <div style="text-align: left">救助支付金额：{{ order.maf_pay }}</div>
      <div></div>
    </div>-->
  </div>
</template>

<script>
import { uParseTime } from "@/utils/tools";

export default {
  props: {
    list: {
      type: Array,
      default: function () {
        return [];
      },
    },
    patient: {
      type: Object,
      default: function () {
        return {};
      },
    },
    order: {
      type: Object,
      default: function () {
        return {};
      },
    },
    admin: {
      type: Object,
      default: function () {
        return {};
      },
    },
    hospital: {
      type: Object,
      default: function () {
        return {};
      },
    },
  },
  data() {
    return {
      page: 1,
      pageArr: [],
    };
  },
  methods: {
    getNowTime: function () {
      let dateTime;
      let yy = new Date().getFullYear();
      let mm = new Date().getMonth() + 1;
      let dd = new Date().getDate();
      let hh = new Date().getHours();
      let mf =
        new Date().getMinutes() < 10
          ? "0" + new Date().getMinutes()
          : new Date().getMinutes();
      let ss =
        new Date().getSeconds() < 10
          ? "0" + new Date().getSeconds()
          : new Date().getSeconds();
      dateTime = yy + "-" + mm + "-" + dd + " " + hh + ":" + mf + ":" + ss;
      return dateTime;
    },
    getTimes(time) {
      return uParseTime(time, "{y}-{m}-{d}");
    },
    getTotal: function (items) {
      let total = 0;
      for (let i = 0; i < items.length; i++) {
        total = total + (items[i].count * items[i].price).toFixed(2);
      }
      return total;
    },
  },
  watch: {
    list: {
      handler(newVal) {
        // this.getPage()
      },
      deep: true,
    },
  },
};
</script>

<style lang="scss" scoped>
.allList-print {
  -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27),
    0 0 60px rgba(0, 0, 0, 0.06) inset;
  -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27),
    0 0 40px rgba(0, 0, 0, 0.06) inset;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset;
  margin-bottom: 20px;
  padding: 20px 10px;
}

.allListTitle {
  font-size: 24px;
  text-align: center;
  font-weight: bold;
  margin-bottom: 10px;
}

.allListInfo {
  display: flex;
  font-size: 16px;
  justify-content: space-between;
  margin: 10px 0;
}

.allListInfo div {
  min-width: 200px;
}

.allListTable {
  width: 100%;
  text-align: center;
  border-collapse: collapse;
  line-height: 20px;
  font-size: 14px;
  border-color: #000;
  text-align: left;
}

.allListTable tr td {
  padding: 0 5px;
}

.tableBottom {
  font-size: 16px;
  display: flex;
  margin-top: 20px;
}

.tableBottomOne {
  margin-right: 40px;
}

.listTable {
  width: 100%;
  text-align: center;
  border-collapse: collapse;
  line-height: 40px;
  font-size: 14px;
  border-color: #000;
  text-align: left;
}
.listTable thead {
  width: 100%;
  text-align: center;
  border-collapse: collapse;
  line-height: 40px;
  font-size: 14px;
  border-color: #000;
  text-align: left;
}
.listTable thead tr td {
  padding: 0 5px;
}
.tableBottom {
  font-size: 16px;
  display: flex;
  margin-top: 20px;
}
.tableBottomOne {
  margin-right: 40px;
}
</style>
