<template>
  <div id="statement-print" class="statement-print">
    <div class="statementTitle" v-if="this.$store.getters.xt_user.org_id == 10188 || this.$store.getters.xt_user.org_id == 10217">江苏省社会医疗保险医疗费用结算单</div>
    <div class="statementTitle" v-if="this.$store.getters.xt_user.org_id == 10088">广水源生堂社会医疗保险医疗费用结算单</div>
    <div class="statementTitle" v-if="this.$store.getters.xt_user.org_id != 10188 && this.$store.getters.xt_user.org_id != 10217 &&this.$store.getters.xt_user.org_id != 10088">广东省社会医疗保险医疗费用结算单</div>

    <table class="statementTable" border="1">
      <tr>
        <td width="80">机构名称</td>
        <td colspan="4">{{info.fixmedins_name}}</td>
        <td width="80">机构编码</td>
        <td colspan="4">{{info.fixmedins_code}}</td>
        <td width="100">医保结算级别</td>
        <td width="100"></td>

      </tr>
      <tr>
        <td width="90">就医登记号</td>
        <td colspan="11">{{info.his.number}}</td>
      </tr>
      <tr>
        <td width="80">姓名</td>
        <td width="80">{{info.his.name}}</td>
        <td width="80">性别</td>
        <td width="50" v-if="info.patient.gender == 1">男</td>
        <td width="50" v-if="info.patient.gender == 2">女</td>

        <td width="80">出生日期</td>
        <td width="100"></td>
        <td width="90">个人电脑号</td>
        <td width="110"></td>
        <td width="80">人员类别</td>
        <td colspan="3"></td>
      </tr>
      <tr>
        <td>单位名称</td>
        <td colspan="5"></td>
        <td width="80">联系电话</td>
        <td width="110">{{info.patient.phone}}</td>
        <td width="80">身份证号</td>
        <td colspan="3">{{info.patient.id_card_no}}</td>
      </tr>
      <tr>
        <td>住院号</td>
        <td>{{info.number}}</td>
        <td>科别</td>
        <td width="100"></td>
        <td>床号</td>
        <td></td>
        <td>入院日期</td>
        <td>{{info.his.in_hosptial_time ? info.his.in_hosptial_time.split(' ')[0] : ''}}</td>
        <td>出院日期</td>
        <td width="100">{{info.his.out_hosptial_time ? info.his.out_hosptial_time.split(' ')[0] : ''}}</td>
        <td>住院天数</td>
        <td>{{getDay(info.his.in_hosptial_time.split(' ')[0] ,info.his.out_hosptial_time.split(' ')[0])}}</td>

      </tr>
      <tr>
        <td>险种</td>
        <td colspan="2"></td>


        <td>入院第一诊断</td>
        <td colspan="3">{{info.diagnosis}}</td>
        <td>出院第一诊断</td>
        <td colspan="4">{{info.diagnosis}}</td>
      </tr>
      <tr>
        <td>业务类别</td>
        <td colspan="5" style="text-align:left;padding-left:10px;"></td>


        <td>结算时间</td>
        <td colspan="5" style="text-align:left;padding-left:10px;">{{info.setl_time ? info.setl_time.split(' ')[0] : ''}}</td>
      </tr>
      <tr>
        <td colspan="12" style="text-align:left;padding-left:10px;">
<!--          本次就医：总费用{{info.medfee_sumamt}}元，基金支付{{info.fund_pay_sumamt}}元，个人支付{{info.medfee_sumamt}}元。-->
          本次就医：总费用{{info.medfee_sumamt}}元，基金支付{{info.fund_pay_sumamt}}元，个人支付{{info.psn_pay}}元。
          (起付线 {{info.act_pay_dedc}}元, 先自付 {{info.preselfpay_amt}}元, 段内自付 {{info.medfee_sumamt}}元 )

        </td>
      </tr>
      <tr>
        <td>费用名称</td>
        <td colspan="2">总费用</td>
        <td>自费</td>
        <td colspan="2">部分项目自付</td>
        <td>费用名称</td>
        <td colspan="2">总费用</td>
        <td>自费</td>
        <td colspan="2">部分项目自付</td>
      </tr>
      <tr>
        <td>床位费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.bed_cost_total}}</td>
        <td style="text-align:right;padding-right:10px;">{{info.bed_cost_self_total}}</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.bed_cost_part_self_total}}</td>
        <td>西成药</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.western_medicine_cost_total}}</td>
        <td style="text-align:right;padding-right:10px;">{{info.western_medicine_cost_self_total}}</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.western_medicine_cost_part_self_total}}</td>
      </tr>
      <tr>
        <td>中药费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
        <td style="text-align:right;padding-right:10px;">0</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
        <td>中成药</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.chinese_traditional_medicine_cost_total}}
        </td>
        <td style="text-align:right;padding-right:10px;">{{info.chinese_traditional_medicine_cost_self_total}}</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">
          {{info.chinese_traditional_medicine_cost_part_self_total}}
        </td>
      </tr>
      <tr>
        <td>中草药</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
        <td style="text-align:right;padding-right:10px;">0</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
        <td>检查费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.check_cost_total}}</td>
        <td style="text-align:right;padding-right:10px;">{{info.check_cost_self_total}}</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.check_cost_part_self_total}}</td>
      </tr>
      <tr>
        <td>治疗费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.treat_cost_total}}</td>
        <td style="text-align:right;padding-right:10px;">{{info.treat_cost_self_total}}</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.treat_cost_part_self_total}}</td>
        <td>放射费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
        <td style="text-align:right;padding-right:10px;">0</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
      </tr>
      <tr>
        <td>手术费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.operation_cost_total}}</td>
        <td style="text-align:right;padding-right:10px;">{{info.operation_cost_self_total}}</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.operation_cost_part_self_total}}</td>
        <td>化验费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.laboratory_cost_total}}</td>
        <td style="text-align:right;padding-right:10px;">{{info.laboratory_cost_self_total}}</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.laboratory_cost_part_self_total}}</td>
      </tr>
      <tr>
        <td>输血费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
        <td style="text-align:right;padding-right:10px;">0</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
        <td>输氧费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
        <td style="text-align:right;padding-right:10px;">0</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
      </tr>
      <tr>
        <td>其他</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.other_cost_total}}</td>
        <td style="text-align:right;padding-right:10px;">{{info.other_cost_self_total}}</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.other_cost_part_self_total}}</td>
        <td>麻醉费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
        <td style="text-align:right;padding-right:10px;">0</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
      </tr>
      <tr>
        <td>材料费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.material_cost_total}}</td>
        <td style="text-align:right;padding-right:10px;">{{info.material_cost_self_total}}</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{info.material_cost_part_self_total}}</td>
        <td>特殊检查费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
        <td style="text-align:right;padding-right:10px;">0</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
      </tr>
      <tr>
        <td>特殊治疗费</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
        <td style="text-align:right;padding-right:10px;">0</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">0</td>
        <td style="text-align:right;padding-right:10px;"></td>
        <td colspan="2" style="text-align:right;padding-right:10px;"></td>
        <td style="text-align:right;padding-right:10px;"></td>
        <td colspan="2" style="text-align:right;padding-right:10px;"></td>
      </tr>
      <tr>
        <td>合计</td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{(parseFloat(info.bed_cost_total) +
            parseFloat(info.operation_cost_total) + parseFloat(info.other_cost_total) +
            parseFloat(info.material_cost_total) + parseFloat(info.western_medicine_cost_total) +
            parseFloat(info.chinese_traditional_medicine_cost_total) + parseFloat(info.check_cost_total) +
            parseFloat(info.laboratory_cost_total) + parseFloat(info.treat_cost_total)).toFixed(2) }}
        </td>
        <td style="text-align:right;padding-right:10px;">{{(parseFloat(info.bed_cost_self_total )+
            parseFloat(info.operation_cost_self_total) + parseFloat(info.other_cost_self_total) +
            parseFloat(info.material_cost_self_total) + parseFloat(info.western_medicine_cost_self_total) +
            parseFloat(info.chinese_traditional_medicine_cost_self_total) + parseFloat(info.check_cost_self_total) +
            parseFloat(info.laboratory_cost_self_total) + parseFloat(info.treat_cost_self_total)).toFixed(2)}}
        </td>
        <td colspan="2" style="text-align:right;padding-right:10px;">{{(parseFloat(info.bed_cost_part_self_total) +
            parseFloat(info.operation_cost_part_self_total) + parseFloat(info.other_cost_part_self_total) +
            parseFloat(info.material_cost_part_self_total) + parseFloat(info.western_medicine_cost_part_self_total) +
            parseFloat(info.chinese_traditional_medicine_cost_part_self_total) +
            parseFloat(info.check_cost_part_self_total) + parseFloat(info.laboratory_cost_part_self_total) +
            parseFloat(info.treat_cost_part_self_total)).toFixed(2)}}
        </td>
        <td style="text-align:right;padding-right:10px;"></td>
        <td colspan="2" style="text-align:right;padding-right:10px;"></td>
        <td style="text-align:right;padding-right:10px;"></td>
        <td colspan="2" style="text-align:right;padding-right:10px;"></td>
      </tr>
      <tr>
        <td colspan="3" style="text-align:left;padding-left:10px;">基本医疗保险统筹基金支付</td>
        <td colspan="3"></td>
        <td colspan="3" style="text-align:left;padding-left:10px;">大额基金支付</td>
        <td colspan="3"></td>
      </tr>
      <tr>
        <td colspan="3" style="text-align:left;padding-left:10px;">大病基金支付</td>
        <td colspan="3"></td>
        <td colspan="3" style="text-align:left;padding-left:10px;">补充保险基金支付</td>
        <td colspan="3"></td>
      </tr>
      <tr>
        <td colspan="3" style="text-align:left;padding-left:10px;">医疗救助基金支付</td>
        <td colspan="3"></td>
        <td colspan="3" style="text-align:left;padding-left:10px;">公务员基金支付</td>
        <td colspan="3"></td>
      </tr>
      <tr>
        <td colspan="3" style="text-align:left;padding-left:10px;">其他基金支付</td>
        <td colspan="3"></td>
        <td colspan="3" style="text-align:left;padding-left:10px;">个人账户支付</td>
        <td colspan="3"></td>
      </tr>
      <tr>
        <td>收款人:</td>
        <td colspan="2">{{info.charge_admin.user_name}}</td>
        <td>审核人:</td>
        <td colspan="2" v-if="this.$store.getters.xt_user.org_id == 10106">{{'梅晓辉'}}</td>
        <td colspan="2" v-if="this.$store.getters.xt_user.org_id != 10106">{{info.p_admin.user_name}}</td>

        <td>制单人:</td>
        <td colspan="2">{{info.p_admin.user_name}}</td>
        <td>打印日期</td>
        <td colspan="2">{{getNowTime()}}</td>
      </tr>
      <tr>
        <td colspan="12" style="text-align:left;padding-left:10px;line-height:20px;">
          注: 1、部分项目自付金额是指基本医疗保险范围内的项目需参保人先按规定比例自付的金额。<br/>
          &ensp;&ensp;&ensp;2、此表由医院打印。<br/>
          &ensp;&ensp;&ensp;3、此表一式两份，医院、参保人各一份。
        </td>
      </tr>
      <tr>
        <td colspan="12" style="text-align:left;padding-left:10px;">
          病人家属签字:
        </td>
      </tr>
    </table>
  </div>
</template>
<script>
export default {
  props: {
    info: {
      type: Object,
      default: function() {
        return {}
      }
    }, p_admin: {
      type: Object,
      default: function() {
        return {}
      }
    }, charge_admin: {
      type: Object,
      default: function() {
        return {}
      }
    }
  },methods:{
    getDay(dateString1,dateString2){
      var  startDate = Date.parse(dateString1);
      var  endDate = Date.parse(dateString2);
      if (startDate>endDate){
        return 0;
      }
      if (startDate==endDate){
        return 1;
      }
      var days=(endDate - startDate)/(1*24*60*60*1000);
      return  days + 1;

    },
    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
    },

  }
}


</script>


<style lang="scss" scoped>
.statement-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;
}

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

.statementTable {
  width: 100%;
  text-align: center;
  border-collapse: collapse;
  line-height: 40px;
  font-size: 14px;
  border-color: #000;
}
</style>
