<template>
  <el-dialog v-model="jieSuanDanDaYingDialog" fullscreen title="打印结算单" @closed="emit('close')">
    <el-affix :offset="50" style="margin-left: 800px">
      <el-button size="small" type="primary" @click="daYingClick">打印</el-button>
    </el-affix>
    <el-affix :offset="100" style="margin-left: 800px">
      <el-button size="small" type="danger" @click="jieSuanDanDaYingDialog = false">退出</el-button>
    </el-affix>
    <br/>
    <div id="setl">
      <div id="setl1">
        <h2 style="text-align: center"><span style="text-decoration: underline">湖南省</span>长沙市医疗保障基金结算清单
        </h2>
        <div class="tanXingHeZiHeng">
          <!--    1    -->
          <div class="tanXingHeZiShu" style="justify-content: end">
            <div class="wen-zi">
              <div>定点医疗机构名称</div>
              <div><span>长沙泰和医院</span></div>
            </div>
            <div class="wen-zi">
              <div>医保编号</div>
              <div>{{ setlinfo.hiNo }}</div>
            </div>
          </div>
          <!--    1    -->
          <!--    2    -->
          <div class="tanXingHeZiShu" style="justify-content: end">
            <div class="wen-zi">
              <div>定点医疗机构代码</div>
              <div><span>H43010500370</span></div>
            </div>
            <div class="wen-zi">
              <div>病案号</div>
              <div>
                <span>{{ setlinfo.medcasno }}</span>
              </div>
            </div>
          </div>
          <!--    2    -->
          <!--    3    -->
          <div class="tanXingHeZiShu">
            <div class="wen-zi">
              <div>清单流水号</div>
              <div class="w90">
                <span>{{ setlinfo.setlListId }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>医保结算等级</div>
              <div class="w90"><span>三级</span></div>
            </div>
            <div class="wen-zi">
              <div>申报时间</div>
              <div class="w90">
                <span style="size: 10px">{{ setlinfo.dclaTime }}</span>
              </div>
            </div>
          </div>
        </div>
        <div
            style="border: 1px solid #000; line-height: 20px; text-align: center; background-color: rgba(127, 187, 236, 0.8)">
          <b style="color: #000"> 一、基本信息 </b>
        </div>
        <div class="divBorder" style="padding: 4px; margin-bottom: 4px">
          <!--   第一行     -->
          <div class="tanXingHeZiHeng" style="margin-top: 5px">
            <div class="wen-zi">
              <div class="w30">姓名</div>
              <div class="w90">
                <span>{{ setlinfo.psnName }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>性别</div>
              <div class="w10">
                <span>[{{ blankToSpace(setlinfo.gend) }}]</span>
              </div>
              <div>1.男 2.女</div>
            </div>
            <div class="wen-zi">
              <div>出生日期</div>
              <div class="w110">
                <span>{{ brdyName(setlinfo.brdy) }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>年龄</div>
              <div style="width: 25px">
                <span>{{ getAge(setlinfo.age) }}</span>
              </div>
              <div>岁</div>
            </div>
            <div class="wen-zi">
              <div>国籍</div>
              <div class="w180">
                <span>{{ setlinfo.ntlyName }}</span>
              </div>
            </div>
          </div>
          <!--   第一行     -->
          <!--   第二行     -->
          <div class="tanXingHeZiHeng">
            <div class="wen-zi" style="width: 150px">
              <div style="width: 120px">(年龄不足1周岁)年龄</div>
              <div style="width: 25px">
                <span>{{ setlinfo.nwbAge }}</span>
              </div>
              <div>天</div>
            </div>
            <div class="wen-zi">
              <div>民族</div>
              <div style="width: 55px">
                <span>{{ setlinfo.natyName }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>患者证件类别</div>
              <div class="w120">
                <span>{{ setlinfo.patnCertTypeName }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>患者证件号码</div>
              <div class="w120">
                <span>{{ setlinfo.certno }}</span>
              </div>
            </div>
          </div>
          <!--   第二行     -->
          <!--   第三行     -->
          <div class="tanXingHeZiHeng">
            <div class="wen-zi">
              <div>职业</div>
              <div class="w120">
                <span>{{ setlinfo.prfsName }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>现住址</div>
              <div style="width: 300px; margin-right: 50px">
                <span>{{ setlinfo.currAddr }}</span>
              </div>
            </div>
          </div>
          <!--   第三行     -->
          <!--   第四行     -->
          <div class="tanXingHeZiHeng">
            <div class="wen-zi">
              <div>工作单位及地址</div>
              <div style="width: 330px">
                <span>{{ setlinfo.empName }} {{ setlinfo.empAddr }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>单位电话</div>
              <div class="w100">
                <span>{{ setlinfo.empTel }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>邮编</div>
              <div class="w100">
                <span>{{ setlinfo.poscode }}</span>
              </div>
            </div>
          </div>
          <!--   第四行     -->
          <!--   第五行     -->
          <div class="tanXingHeZiHeng">
            <div class="wen-zi">
              <div>联系人姓名</div>
              <div class="w90">
                <span>{{ setlinfo.conerName }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>关系</div>
              <div class="w90">
                <span>{{ setlinfo.patnRltsName }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>地址</div>
              <div class="w180">
                <span>{{ setlinfo.conerAddr }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>电话</div>
              <div class="w100">
                <span>{{ setlinfo.conerTel }}</span>
              </div>
            </div>
          </div>
          <!--   第五行     -->
          <!--   第六行     -->
          <div class="tanXingHeZiHeng">
            <div class="wen-zi">
              <div>医保类型</div>
              <div class="w120">
                <span>{{ setlinfo.hiTypeName }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>特殊人员类型</div>
              <div class="w90">
                <span>{{ setlinfo.spPsnTypeName }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>参保地</div>
              <div class="w180">
                <span>{{ setlinfo.insuplcName }}</span>
              </div>
            </div>
          </div>
          <!--   第六行     -->
          <!--   第七行     -->
          <div class="tanXingHeZiHeng">
            <div class="wen-zi">
              <div>新生儿入院类型</div>
              <div class="w90">
                <span>{{ setlinfo.nwbAdmTypeName }}</span>
              </div>
            </div>
            <div class="wen-zi">
              <div>新生儿出生体重</div>
              <div class="w50">
                <span>{{ setlinfo.nwbBirWt }}</span>
              </div>
              <div>克</div>
            </div>
            <div class="wen-zi">
              <div>新生儿入院体重</div>
              <div class="w50">
                <span>{{ setlinfo.nwbAdmWt }}</span>
              </div>
              <div>克</div>
            </div>
          </div>
          <!--   第七行     -->
        </div>
        <!--  二、门诊慢特病诊疗信息    -->
        <div v-if="!zyFlag">
          <div
              style="border: 1px solid #000; line-height: 20px; text-align: center; background-color: rgba(127, 187, 236, 0.8)">
            <b style="color: #000"> 二、门诊慢特病诊疗信息 </b>
          </div>
          <div class="divBorder" style="padding: 0 5px">
            <div style="display: flex; flex-direction: column">
              <!--   第一行     -->
              <div class="tanXingHeZiHeng">
                <div class="wen-zi">
                  <div>诊断科别</div>
                  <div class="w90">
                    <span>{{ setlinfo.opspDiagCaty }}</span>
                  </div>
                </div>
                <div class="wen-zi">
                  <div>就诊日期</div>
                  <div class="w50">
                    <span>{{ setlinfo.opspMdtrtDate }}</span>
                  </div>
                </div>
              </div>
            </div>
            <!--   第一行     -->
            <!--   第二行     -->
            <div class="tanXingHeZiShu" style="margin-top: 5px">
              <table>
                <tr>
                  <th>诊断名称</th>
                  <th>诊断代码</th>
                  <th>手术及操作名称</th>
                  <th>手术及操作代码</th>
                </tr>
                <tr v-for="(item, index) in opspdiseinfoData">
                  <td>{{ item?.diagName }}</td>
                  <td>{{ item?.diagCode }}</td>
                  <td>{{ item?.oprnOprtName }}</td>
                  <td>{{ item?.oprnOprtCode }}</td>
                </tr>
              </table>
            </div>
            <!--  第二行     -->
          </div>
          <!--      二、门诊慢特病诊疗信息    -->
          <!--三、住院诊疗信息-->
        </div>
        <div v-if="zyFlag">
          <div
              style="border: 1px solid #000; line-height: 20px; text-align: center; background-color: rgba(127, 187, 236, 0.8); margin-top: 5px">
            <b style="color: #000"> 三、住院诊疗信息 </b>
          </div>
          <div class="divBorder" style="padding: 0 5px">
            <!--        1-->
            <div class="div-border-bottom">
              <div class="wen-zi">
                <div>住院医疗类型</div>
                <div class="w10">
                  <span>[{{ blankToSpace(setlinfo.iptMedType) }}]</span>
                </div>
                <div>1.住院 2.日间手术</div>
              </div>
            </div>
            <!--1-->
            <!--2-->
            <div class="div-border-bottom">
              <div class="wen-zi">
                <div>入院途径</div>
                <div class="w10">
                  <span>[{{ blankToSpace(setlinfo.admWay) }}]</span>
                </div>
                <div>1.急诊 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.门诊&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.其他医疗机构转入&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  9.其他
                </div>
              </div>
            </div>
            <!--2-->
            <!--3-->
            <div class="div-border-bottom">
              <div class="wen-zi">
                <div>治疗类别</div>
                <div class="w20">
                  <span>[{{ blankToSpace(setlinfo.trtType) }}]</span>
                </div>
                <div>10.西医 21.中医 22.民族医 30.中西医</div>
              </div>
            </div>
            <!--3-->
            <!--4-->
            <div class="div-border-bottom">
              <div class="wen-zi">
                <div>入院时间</div>
                <div class="w120">
                  <span>{{ getDateName(setlinfo.admTime) }}</span>
                </div>
              </div>
              <div class="wen-zi">
                <div>入院科别</div>
                <div class="w120">
                  <span>{{ setlinfo.admCatyName }}</span>
                </div>
              </div>
              <div class="wen-zi">
                <div>转科科别</div>
                <div class="w120">
                  <span>{{ setlinfo.refldeptDeptName }}</span>
                </div>
              </div>
            </div>
            <!--4-->
            <!--5-->
            <div class="div-border-bottom">
              <div class="wen-zi">
                <div>出院时间</div>
                <div class="w120">
                  <span>{{ getDateName(setlinfo.dscgTime) }}</span>
                </div>
              </div>
              <div class="wen-zi">
                <div>出院科别</div>
                <div class="w120">
                  <span>{{ setlinfo.dscgCatyName }}</span>
                </div>
              </div>
              <div class="wen-zi">
                <div>实际住院</div>
                <div class="w120">
                  <span>{{ setlinfo.actIptDays }}</span>
                </div>
                <div>天</div>
              </div>
            </div>
            <!--5-->
            <!--6-->
            <div class="tanXingHeZiHeng" style="margin-top: 0">
              <div class="wen-zi">
                <div>门（急）诊诊断（西医诊断）</div>
                <div class="w120">
                  <span>{{ setlinfo.otpWmDise }}</span>
                </div>
              </div>
              <div class="wen-zi">
                <div>疾病代码</div>
                <div class="w120">
                  <span>{{ setlinfo.wmDiseCode }}</span>
                </div>
              </div>
            </div>
            <div class="tanXingHeZiHeng" style="margin-top: 0">
              <div class="wen-zi">
                <div>门（急）诊诊断（中医诊断）</div>
                <div class="w120">
                  <span>{{ setlinfo.otpTcmDise }}</span>
                </div>
              </div>
              <div class="wen-zi">
                <div>疾病代码</div>
                <div class="w120">
                  <span>{{ setlinfo.tcmDiseCode }}</span>
                </div>
              </div>
            </div>
            <!--6-->
          </div>
          <div class="tanXingHeZiHeng">
            <table style="width: 100%">
              <tr>
                <th>出院西医诊断</th>
                <th>疾病代码</th>
                <th>入院病情</th>
                <th>出院中医诊断</th>
                <th>疾病代码</th>
                <th>入院病情</th>
              </tr>
              <tr v-for="(item, index) in diseinfoData">
                <td>{{
                    index === 0 ? '主要诊断：' + item.xiYiDisDiagComment : index === 1 ? '其他诊断：' + item.xiYiDisDiagComment : item.xiYiDisDiagComment
                  }}
                </td>
                <td>{{ item.xiYiDisDiag }}</td>
                <td>{{ getAdmissCond(item.xiYiAdmissCond) }}</td>
                <td>{{
                    index === 0 ? '主病：' + item.ZhongYiDiagComment : index === 1 ? '主证：' + item.ZhongYiDiagComment : item.ZhongYiDiagComment
                  }}
                </td>
                <td>{{ item.ZhongYiDisDiag }}</td>
                <td>{{ getAdmissCond(item.ZhongYiAdmissCond) }}</td>
              </tr>
            </table>
          </div>
          <div class="tanXingHeZiHeng" style="margin-top: 2px">
            <div class="wen-zi">
              <div>诊断代码计数</div>
              <div class="w90">
                <span>{{ setlinfo.diagCodeCnt }}</span>
              </div>
            </div>
          </div>
          <!--三、住院诊疗信息-->
          <div id="setl2">
            <div v-for="(item, index) in oprninfoData">
              <table style="width: 100%">
                <tr>
                  <td>{{ index === 0 ? '主要手术及操作名称' : '其他手术及操作名称' + index }}</td>
                  <td>{{ index === 0 ? '主要手术及操作代码' : '其他手术及操作代码' + index }}</td>
                  <td>麻醉方式</td>
                  <td>术者医师名</td>
                  <td>术者医师代码</td>
                  <td>麻醉医生姓名</td>
                  <td>麻醉医生代码</td>
                </tr>
                <tr>
                  <td>{{ item.ssmc }}</td>
                  <td>{{ item.ssbm }}</td>
                  <td>{{ maZuiName(item.mzff) }}</td>
                  <td>{{ item.ssysName }}</td>
                  <td>{{ item.operDrCode }}</td>
                  <td>{{ item.mzysName }}</td>
                  <td>{{ item.anstDrCode }}</td>
                </tr>
              </table>
              <div style="display: flex; justify-content: space-between">
                <div class="wen-zi">
                  <div>手术及操作时间</div>
                  <div class="w300 div-border-bottom">
                    <span>{{ getShouShuShiJian(item) }} </span>
                  </div>
                </div>
                <div class="wen-zi">
                  <div>麻醉时间</div>
                  <div class="w300 div-border-bottom">
                    {{ getMaZuiShiJian(item) }}
                  </div>
                </div>
              </div>
              <span v-if="index === 0"></span>
            </div>
            <div>
              <br>
              手术操作代码计数： {{ setlinfo.oprnOprtCodeCnt }}
            </div>
            <div class="tanXingHeZiHeng div-border-bottom">
              <div class="wen-zi">
                <div>呼吸机使用时间</div>
                <div class="w300">
                  <span>{{ luNeiShiJian(setlinfo.ventUsedDura) }}</span>
                </div>
              </div>
            </div>
            <div class="tanXingHeZiHeng div-border-bottom">
              <div class="wen-zi">
                <div>颅脑损伤患者昏迷时间：</div>
                <div style="height: 40px; border: 0">
                  <div>入院前 {{ luNeiShiJian(setlinfo.pwcryBfadmComaDura) }}</div>
                  <br/>
                  <div>入院后 {{ luNeiShiJian(setlinfo.pwcryAfadmComaDura) }}</div>
                </div>
              </div>
            </div>

            <table>
              <tr>
                <th>
                  重症监护病房类型 （CCU、NICU、ECU、SICU、<br/>
                  PICU、RICU、ICU（综合）、其 <br/>
                  他）
                </th>
                <th>
                  进重症监护室时间 <br/>
                  (_年_月_日_时_分)
                </th>
                <th>
                  出重症监护室时间<br/>
                  (_年_月_日_时_分)
                </th>
                <th>合计（ 时 分）</th>
              </tr>
              <tr v-for="(item, index) in icuinfoData">
                <td>{{ item.scsCutdWardType }}</td>
                <td>{{ item.scsCutdInpoolTime }}</td>
                <td>{{ item.scsCutdExitTime }}</td>
                <td>{{ item.scsCutdSumDura }}</td>
              </tr>
            </table>

            <table>
              <tr>
                <th>输血品种</th>
                <th>输血量</th>
                <th>输血计量单位</th>
              </tr>
              <tr v-for="(item, index) in bldData">
                <td>{{ item.bldCat }}</td>
                <td>{{ item.bldAmt }}</td>
                <td>{{ item.bldUnt }}</td>
              </tr>
            </table>

            <div class="tanXingHeZiHeng div-border-bottom">
              <div class="wen-zi">
                <div>特级护理天数</div>
                <div class="w90">
                  <span>{{ setlinfo.spgaNurscareDays }}</span>
                </div>
              </div>
              <div class="wen-zi">
                <div>一级护理天数</div>
                <div class="w90">
                  <span>{{ setlinfo.lv1NurscareDays }}</span>
                </div>
              </div>
              <div class="wen-zi">
                <div>二级护理天数</div>
                <div class="w90">
                  <span>{{ setlinfo.scdNurscareDays }}</span>
                </div>
              </div>
              <div class="wen-zi">
                <div>三级护理天数</div>
                <div class="w90">
                  <span>{{ setlinfo.lv3NurscareDays }}</span>
                </div>
              </div>
            </div>

            <div class="tanXingHeZiHeng">
              <div class="wen-zi">
                <div>离院方式</div>
                <div class="w10">
                  <span>[{{ blankToSpace(setlinfo.dscgWay) }}]</span>
                </div>
                <div>1.医嘱离院 2. 医嘱转院，</div>
              </div>
              <div class="wen-zi">
                <div>拟接收机构名称</div>
                <div class="w90">
                  <span>{{ setlinfo.acpMedinsName }}</span>
                </div>
              </div>
              <div class="wen-zi">
                <div>拟接收机构代码</div>
                <div class="w90">
                  <span>{{ setlinfo.acpOptinsCode }}</span>
                </div>
              </div>
            </div>

            <div class="tanXingHeZiHeng div-border-bottom" style="margin-bottom: 4px">3.转社区、转卫生院机构， 4.非医嘱离院
              5.死亡 9.其他
            </div>

            <div class="tanXingHeZiHeng div-border-bottom">
              <div class="wen-zi">
                <div>是否有出院 31 天内再住院计划</div>
                <div class="w10">
                  <span>[{{ blankToSpace(setlinfo.daysRinpFlag31) }}]</span>
                </div>
                <div>1.无 2.有</div>
              </div>

              <div class="wen-zi">
                <div>目的</div>
                <div style="width: 400px">
                  <span>{{ setlinfo.daysRinpPup31 }}</span>
                </div>
              </div>
            </div>

            <div class="tanXingHeZiHeng div-border-bottom" style="justify-content: flex-start">
              <div class="wen-zi">
                <div>主诊医师姓名</div>
                <div class="w90">
                  <span>{{ setlinfo.chfpdrName }}</span>
                </div>
              </div>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <div class="wen-zi">
                <div>主诊医师代码</div>
                <div class="w90">
                  <span>{{ setlinfo.chfpdrCode }}</span>
                </div>
              </div>
            </div>

            <div class="tanXingHeZiHeng div-border-bottom" style="justify-content: flex-start">
              <div class="wen-zi">
                <div>责任护士姓名</div>
                <div class="w90">
                  <span>{{ setlinfo.respNursName }}</span>
                </div>
              </div>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <div class="wen-zi">
                <div>责任护士代码</div>
                <div class="w90">
                  <span>{{ setlinfo.respNursCode }}</span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div id="setl3">
        <div
            style="border: 1px solid #000; line-height: 20px; text-align: center; background-color: rgba(127, 187, 236, 0.8); margin-top: 5px">
          <b style="color: #000"> 四、医疗收费信息</b>
        </div>

        <div class="tanXingHeZiHeng" style="justify-content: start">
          <div class="tanXingHeZiShu">
            <div class="wen-zi">
              <div>业务流水号：</div>
              <div class="w210">
                <span>{{ setlinfo.bizSn }}</span>
              </div>
            </div>

            <div class="wen-zi">
              <div>票据代码：</div>
              <div class="w120">
                <span>{{ setlinfo.billCode }}</span>
              </div>
            </div>

            <div class="wen-zi">
              <div>票据号码：</div>
              <div class="w120">
                <span>{{ setlinfo.billNo }}</span>
              </div>
            </div>
          </div>

          <div class="wen-zi">
            <div style="margin-left: 10px">结算期间</div>
            <div class="w250" style="margin-left: 10px; line-height: 45px">
              {{ nianYueRi(setlinfo.setlBegnDate) }} -
              {{ nianYueRi(setlinfo.setlEndDate) }}
            </div>
          </div>
        </div>

        <table>
          <tr>
            <th>项目名称</th>
            <th>金额</th>
            <th>甲类</th>
            <th>乙类</th>
            <th>自费</th>
            <th>其他</th>
          </tr>

          <tr v-for="(item, index) in iteminfoData">
            <td>{{ item.medChrgitmName }}</td>
            <td>{{ item.amt }}</td>
            <td>{{ item.claaSumfee }}</td>
            <td>{{ item.clabAmt }}</td>
            <td>{{ item.fulamtOwnpayAmt }}</td>
            <td>{{ item.othAmt }}</td>
          </tr>
        </table>
        <!--第二页-->
        <div class="tanXingHeZiHeng" :style="{ height: (7 + qiTaPayinfoData.length) * 30 + 'px' }">
          <div id="yiBaoZhiFu" style="width: 50%">
            <table :style="geRenZhiFuTableHeight">
              <tr>
                <th colspan="2">医保统筹基金支付</th>
                <th style="width: 90px">{{ setlinfo.fundPaySumamt }}</th>
              </tr>
              <tr>
                <th rowspan="3">补充医疗保险支付</th>
                <th>职工大额补助</th>
                <td>{{ payinfoData['330100'].fundPayamt }}</td>
              </tr>
              <tr>
                <th>居民大病保险</th>
                <td>{{ payinfoData['390200'].fundPayamt }}</td>
              </tr>
              <tr>
                <th>公务员医疗补助</th>
                <td>{{ payinfoData['320100'].fundPayamt }}</td>
              </tr>
              <tr>
                <th colspan="2">医疗救助支付</th>
                <td>{{ setlinfo.mafPay }}</td>
              </tr>
              <tr>
                <th :rowspan="3 + qiTaPayinfoData.length">其他支付</th>
                <th>企业补充</th>
                <td>{{ payinfoData['370100'].fundPayamt }}</td>
              </tr>
              <tr>
                <th>商业保险</th>
                <td></td>
              </tr>
              <tr v-for="(item, index) in qiTaPayinfoData">
                <td>{{ item.name }}</td>
                <td>{{ item.fundPayamt }}</td>
              </tr>
            </table>
          </div>
          <!--     个人支付信息      -->
          <div style="width: 50%; height: 100%">
            <table :style="geRenZhiFuTableHeight">
              <tr>
                <th rowspan="2">个人负担</th>
                <th>个人自付</th>
                <th style="width: 90px">{{ setlinfo.psnSelfpay }}</th>
              </tr>
              <tr>
                <th>个人自费</th>
                <th>{{ setlinfo.psnOwnpay }}</th>
              </tr>
              <tr>
                <th rowspan="2">个人支付</th>
                <th>个人账户支付</th>
                <th>{{ setlinfo.acctPay }}</th>
              </tr>
              <tr>
                <td>个人现金支付</td>
                <th>{{ setlinfo.psnCashpay }}</th>
              </tr>
            </table>
          </div>
        </div>

        <div class="tanXingHeZiHeng div-border-bottom">
          <div class="wen-zi">
            <div>医保支付方式</div>
            <div class="w10">
              <span>[{{ blankToSpace(setlinfo.hiPaymtd) }}]</span>
            </div>
            <div>1.按项目 2.单病种 3.按病种分值 4.疾病诊断相关分组（DRG） 5.按床日 6.按人头……</div>
          </div>
        </div>

        <div class="tanXingHeZiHeng" style="justify-content: start">
          <div class="tanXingHeZiShu">
            <div class="wen-zi">
              <div>医疗机构填报部门</div>
              <div class="w90">
                <span>{{ setlinfo.medinsFillDept }}</span>
              </div>
            </div>

            <div class="wen-zi">
              <div>医疗机构填报人</div>
              <div class="w90">
                <span>{{ setlinfo.medinsFillPsn }}</span>
              </div>
            </div>
          </div>

          <div class="tanXingHeZiShu" style="margin-left: 120px">
            <div class="wen-zi">
              <div>医保机构</div>
              <div style="width: 230px">
                <span> {{ setlinfo.hsorg }}</span>
              </div>
            </div>

            <div class="wen-zi">
              <div>医保机构经办人</div>
              <div style="width: 230px">
                <span>{{ setlinfo.hsorgOpter }}</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </el-dialog>
</template>

<script name="jieSuanDanDaYing" setup>
import {getLodop, initLodop} from '@/utils/c-lodop'
import {jieSuanDanYangShiCss} from '@/data/css-for-print'
import {daYingShangChuanJieSuanDan} from '@/api/medical-insurance/si-setl-upload'
import {
  brdyName,
  fenLeiZhiFuLeiXing,
  getAdmissCond,
  getAge,
  getDateName,
  getMaZuiShiJian,
  getMedChrgitmTypeData,
  getShouShuData,
  getShouShuShiJian,
  luNeiShiJian,
  maZuiName,
  nianYueRi,
  outpatientChronicDisease,
  zhenDuanData,
  zhongZhenJianHu,
} from './jieSuanDanXiuGai'
import {stringIsBlank} from '@/utils/blank-utils'

const props = defineProps({
  data: {},
})
const emit = defineEmits(['close'])

const jieSuanDanDaYingDialog = ref(true)
/**
 * 这个是门特慢病的
 * @type {Ref<UnwrapRef<*[]>>}
 */
const setlinfo = ref({})
const opspdiseinfoData = ref([])
// 诊断
const diseinfoData = ref([])
// 手术信息
const oprninfoData = ref([])
// 重症监护时间
const icuinfoData = ref([])
// 收费项目信息
const iteminfoData = ref([])
// 基金支付
const payinfoData = ref({})
// 其他基金支付方式
const qiTaPayinfoData = ref([])
//输血量
const bldData = ref([])
//   查询条件
const patNo = ref('')
const times = ref(0)
const ledgerSn = ref(0)

const zyFlag = ref(true)

// 个人支付 表格的长度
const geRenZhiFuTableHeight = ref({
  height: '100%',
})

// 基金支付占位置
let shuShiHua = ['310100', '330100', '390200', '320100', '610100', '370100']
for (let i = 0; i < shuShiHua.length; i++) {
  payinfoData.value[shuShiHua[i]] = {
    fundPayType: shuShiHua[i],
    fundPayamt: '',
  }
}

const daYingClick = () => {
  let LODOP = getLodop()
  LODOP.PRINT_INIT('湖南省长沙市医疗保障基金结算清单') // 初始化打印机 名字
  LODOP.SET_PRINT_PAGESIZE(1, '210mm', '297mm', '') // 设置纸张大小  A4
  LODOP.SET_PRINT_MODE('FULL_WIDTH_FOR_OVERFLOW', true) // 整宽不变形
  LODOP.ADD_PRINT_HTM('2mm', '5mm', '100%', '100%', '<style>' + jieSuanDanYangShiCss + '</style>' + '<body>' + document.getElementById('setl').innerHTML + '</body>') //要打印的内容
  LODOP.PREVIEW() // 关闭
}

onMounted(() => {
  patNo.value = props.data.patNo
  times.value = props.data.times
  ledgerSn.value = props.data.ledgerSn
  zyFlag.value = patNo.value.indexOf('-') === -1
  initLodop()
  for (let i = 0; i < 1; i++) {
    bldData.value.push({
      bldCat: '',
      bldAmt: '',
      bldUnt: '',
    })
  }
  queryJieSuanDan()
})

const queryJieSuanDan = () => {
  daYingShangChuanJieSuanDan(patNo.value, times.value, ledgerSn.value)
      .then((res) => {
        jieSuanDanDaYingDialog.value = true
        setlinfo.value = res.setlinfo
        diseinfoData.value = zhenDuanData(res.diseinfo)
        // 手术
        oprninfoData.value = getShouShuData(res.oprninfo)
        //  医疗收费信息
        iteminfoData.value = getMedChrgitmTypeData(res.iteminfo)
        icuinfoData.value = zhongZhenJianHu(res.icuinfo)
        // 门诊慢特病
        opspdiseinfoData.value = outpatientChronicDisease(res.opspdiseinfo)
        // 基金支付类型
        let fenLeiJiJing = fenLeiZhiFuLeiXing(res.payinfo)
        payinfoData.value = fenLeiJiJing.obj
        qiTaPayinfoData.value = fenLeiJiJing.qiTa
      })
      .catch((e) => {
        jieSuanDanDaYingDialog.value = false
      })
}

const blankToSpace = (value) => {
  if (stringIsBlank(value)) {
    return ' '
  } else {
    return value
  }
}
</script>

<style scoped>
#setl {
  width: 753px;
  overflow-x: hidden;
  display: inline-block;
  vertical-align: top;
  border: 1px solid #000;
  padding: 0 5px;
}

* {
  font-size: 12px !important;
}

div {
  word-wrap: break-word;
  word-break: break-all;
}

table {
  border: 1px solid black;
  border-collapse: collapse;
  width: 100%;
}

th {
  border: 1px solid black;
  text-align: center;
}

td {
  border: 1px solid black;
  text-align: center;
}

tr {
  height: 27px;
  line-height: 27px;
}

.wen-zi {
  display: flex;
  margin-top: 4px;
}

.wen-zi div:first-child {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}

.wen-zi div:nth-child(2) {
  margin-left: 4px;
  vertical-align: middle;
  display: table;
}

.wen-zi div:nth-child(2) span {
  display: table-cell;
  vertical-align: middle;
}

.wen-zi div:nth-child(3) {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}

.divBorder {
  border: 1px solid #000;
}

.div-border-bottom {
  border-bottom: 1px solid #000;
  display: flex;
  justify-content: space-between;
}

.tanXingHeZiHeng {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.tanXingHeZiShu {
  display: flex;
  flex-direction: column;
}

.w5 {
  width: 5px;
}

.w20 {
  width: 20px;
}

.w10 {
  width: 10px;
}

.w25 {
  width: 25px;
}

.w30 {
  width: 30px;
}

.w40 {
  width: 40px;
}

.w50 {
  width: 50px;
}

.w70 {
  width: 70px;
}

.w80 {
  width: 80px;
}

.w85 {
  width: 85px;
}

.w90 {
  width: 90px;
}

.w100 {
  width: 100px;
}

.w110 {
  width: 110px;
}

.w120 {
  width: 120px;
}

.w125 {
  width: 125px;
}

.w130 {
  width: 130px;
}

.w140 {
  width: 140px;
}

.w145 {
  width: 145px;
}

.w150 {
  width: 150px;
}

.w165 {
  width: 165px;
}

.w170 {
  width: 170px;
}

.w180 {
  width: 180px;
}

.w190 {
  width: 190px;
}

.w195 {
  width: 195px;
}

.w200 {
  width: 200px;
}

.w210 {
  width: 210px;
}

.w230 {
  width: 230px;
}

.w250 {
  width: 250px;
}

.w260 {
  width: 260px;
}

.w275 {
  width: 275px;
}

.w300 {
  width: 300px;
}

.w350 {
  width: 350px;
}
</style>
