<template>
  <div class="main-contain">
    <div class="position">
      <bread-crumb :crumbs="crumbs"></bread-crumb>
      <el-button
        :loading="loading"
        size="small"
        icon="el-icon-printer"
        @click="printAction"
        type="primary"
        >打印
      </el-button>
    </div>
    <div class="app-container">
      <div id="print_content">
        <div
          v-for="(record, index) in records"
          :key="index"
          class="print_page_main_content"
          style="position: relative;"
        >
          <div class="order-yy-name">{{ orgname }}</div>
          <div class="order_title">
            血液净化治疗记录单
          </div>
          <div class="row" style="margin-top: 15px;">
            <div class="inline_block">
              姓名：
              <div class="under_line" style="width: 120px;">
                {{ record.patient.name }}
              </div>
            </div>
            <div class="inline_block" style="margin-left: 25px;">
              性别：
              <check-box
                text="男"
                :checked="record.patient.gender == 1"
              ></check-box>
              <check-box
                text="女"
                :checked="record.patient.gender == 2"
              ></check-box>
            </div>
            <div class="inline_block" style="margin-left: 25px;">
              年龄：
              <div class="under_line" style="width: 50px;">
                {{ jsGetAge(record.patient.birthday) }}
              </div>
              岁
            </div>
            <div class="inline_block" style="margin-left: 25px">
              科室：
              <check-box
                text="门诊透析"
                :checked="record.patient.source == 1"
              ></check-box>
              <check-box
                text="住院"
                :checked="record.patient.source == 2"
              ></check-box>
              <!-- TODO -->
            </div>
            <div class="inline_block" style="margin-left: 25px">
              住院号/透析卡号：
              <div class="under_line" style="width: 120px;">
                {{
                  record.patient.admission_number
                    ? record.patient.admission_number
                    : "无"
                }}/{{ record.patient.dialysis_no }}
              </div>
            </div>
          </div>
          <div class="row flex">
            <div class="inline_block">
              诊断：
              <div class="under_line" style="width: 500px;">
                {{ record.patient.diagnose }}
              </div>
            </div>
            <div class="inline_block">
              治疗日期：
              <div class="under_line" style="width: 100px;">
                {{ getTime(record.schedule_date, "{y}-{m}-{d}") }}
              </div>
            </div>
          </div>
          <div class="row">
            <table class="proj_table">
              <tbody>
                <tr>
                  <td width="25px">透<br />前<br />评<br />估</td>
                  <td>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        入院方式：
                        <check-box
                          v-for="(item, index) in way_arr"
                          :key="index"
                          :text="item.name"
                          :checked="
                            isCheckBoxChecked(
                              record.receive_assessment,
                              'way',
                              item.id
                            )
                          "
                        ></check-box>
                        <!--<check-box text="步行"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'way', 1)"></check-box>-->
                        <!--<check-box text="扶行"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'way', 2)"></check-box>-->
                        <!--<check-box text="轮椅"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'way', 3)"></check-box>-->
                        <!--<check-box text="平车"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'way', 4)"></check-box>-->
                      </div>
                      <div class="inline_block" style="margin-left: 30px;">
                        意识：
                        <check-box
                          v-for="(item, index) in consciousness_arr"
                          :key="index"
                          :text="item.name"
                          :checked="
                            isCheckBoxChecked(
                              record.receive_assessment,
                              'consciousness',
                              item.id
                            )
                          "
                        ></check-box>
                        <!--<check-box text="清醒"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'consciousness', 1)"></check-box>-->
                        <!--<check-box text="嗜睡"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'consciousness', 2)"></check-box>-->
                        <!--<check-box text="昏迷"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'consciousness', 3)"></check-box>-->
                        <!--<check-box text="模糊"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'consciousness', 4)"></check-box>-->
                      </div>
                      <div class="inline_block" style="margin-left: 30px;">
                        体温：
                        <div class="under_line" style="width: 60px;">
                          {{
                            record.assessment_before_dislysis
                              ? record.assessment_before_dislysis.temperature
                              : ""
                          }}
                        </div>
                        ℃
                      </div>
                    </div>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        体位：
                        <check-box
                          v-for="(item, index) in posture_arr"
                          :key="index"
                          :text="item.name"
                          :checked="
                            isCheckBoxChecked(
                              record.receive_assessment,
                              'posture',
                              item.id
                            )
                          "
                        ></check-box>
                        <!--<check-box text="自动体位"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'posture', 1)"></check-box>-->
                        <!--<check-box text="平卧位"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'posture', 2)"></check-box>-->
                        <!--<check-box text="半卧位"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'posture', 3)"></check-box>-->
                        <!--<check-box text="端坐位"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'posture', 4)"></check-box>-->
                        <!--<check-box text="躁动不安"-->
                        <!--:checked="isCheckBoxChecked(record.receive_assessment, 'posture', 5)"></check-box>-->
                      </div>
                      <div class="inline_block" style="margin-left: 30px;">
                        病情:
                        <check-box
                          v-for="(item, index) in sick_condition_arr"
                          :key="index"
                          :text="item.name"
                          :checked="
                            isCheckBoxChecked(
                              record.receive_assessment,
                              'sick_condition',
                              item.id
                            )
                          "
                        ></check-box>
                        <!--<check-box text="一般" :checked="isCheckBoxChecked(record.receive_assessment, 'sick_condition', 1)"></check-box>-->
                        <!--<check-box text="重" :checked="isCheckBoxChecked(record.receive_assessment, 'sick_condition', 2)"></check-box>-->
                        <!--<check-box text="危险" :checked="isCheckBoxChecked(record.receive_assessment, 'sick_condition', 3)"></check-box>-->
                        其它:

                        <div class="under_line" style="width: 150px;">
                          {{ record.receive_assessment.sick_condition_other }}
                        </div>
                      </div>
                    </div>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        出血：
                        <check-box
                          text="无"
                          :checked="
                            isCheckBoxChecked(
                              record.assessment_before_dislysis,
                              'is_hemorrhage',
                              2
                            )
                          "
                        ></check-box>
                        <check-box
                          text="有"
                          :checked="
                            isCheckBoxChecked(
                              record.assessment_before_dislysis,
                              'is_hemorrhage',
                              1
                            )
                          "
                        ></check-box>
                        （&nbsp;
                        <check-box
                          text="穿刺点渗血"
                          :checked="
                            isCheckBoxChecked(
                              record.assessment_before_dislysis,
                              'is_hemorrhage',
                              1
                            ) &&
                            record.assessment_before_dislysis.hemorrhage.indexOf(
                              '穿刺点渗血'
                            ) > -1
                              ? true
                              : false
                          "
                        ></check-box>
                        <check-box
                          text="牙龈出血"
                          :checked="
                            isCheckBoxChecked(
                              record.assessment_before_dislysis,
                              'is_hemorrhage',
                              1
                            ) &&
                            record.assessment_before_dislysis.hemorrhage.indexOf(
                              '牙龈出血'
                            ) > -1
                              ? true
                              : false
                          "
                        ></check-box>
                        <check-box
                          text="消化道出血"
                          :checked="
                            isCheckBoxChecked(
                              record.assessment_before_dislysis,
                              'is_hemorrhage',
                              1
                            ) &&
                            record.assessment_before_dislysis.hemorrhage.indexOf(
                              '消化道出血'
                            ) > -1
                              ? true
                              : false
                          "
                        ></check-box>
                        <check-box
                          text="女性经期"
                          :checked="
                            isCheckBoxChecked(
                              record.assessment_before_dislysis,
                              'is_hemorrhage',
                              1
                            ) &&
                            record.assessment_before_dislysis.hemorrhage.indexOf(
                              '女性经期'
                            ) > -1
                              ? true
                              : false
                          "
                        ></check-box>
                        其他：
                        <div class="under_line" style="width: 300px;">
                          {{
                            isCheckBoxChecked(
                              record.assessment_before_dislysis,
                              "is_hemorrhage",
                              1
                            )
                              ? record.assessment_before_dislysis
                                  .hemorrhage_other
                              : ""
                          }}
                        </div>
                        &nbsp;）
                      </div>
                    </div>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        血管通路：
                        <check-box
                          text="自体内瘘"
                          :checked="
                            isBbloodAccessParOperaCheck(
                              record.assessment_before_dislysis,
                              '自体内瘘'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="人造血管"
                          :checked="
                            isBbloodAccessParOperaCheck(
                              record.assessment_before_dislysis,
                              '人造血管'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="直穿"
                          :checked="
                            isBbloodAccessParOperaCheck(
                              record.assessment_before_dislysis,
                              '直穿'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="颈内静脉"
                          :checked="
                            isBbloodAccessParOperaCheck(
                              record.assessment_before_dislysis,
                              '颈内静脉'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="股静脉"
                          :checked="
                            isBbloodAccessParOperaCheck(
                              record.assessment_before_dislysis,
                              '股静脉'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="锁骨下"
                          :checked="
                            isBbloodAccessParOperaCheck(
                              record.assessment_before_dislysis,
                              '锁骨下'
                            )
                          "
                        ></check-box>
                      </div>
                      <div class="inline_block">
                        穿刺方法：
                        <div class="under_line" style="width: 300px;">
                          {{
                            record.assessment_before_dislysis
                              ? record.assessment_before_dislysis
                                  .puncture_method
                              : ""
                          }}
                        </div>
                      </div>
                    </div>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        内瘘：震颤
                        <!-- <check-box text="震颤" :checked="isValueIndexOfCheck(record.assessment_before_dislysis, 'internal_fistula', '震颤-存在')"></check-box> -->
                        （&nbsp;
                        <check-box
                          text="存在"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_before_dislysis,
                              'internal_fistula',
                              '震颤-存在'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="减弱"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_before_dislysis,
                              'internal_fistula',
                              '震颤-减弱'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="无"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_before_dislysis,
                              'internal_fistula',
                              '震颤-无'
                            )
                          "
                        ></check-box>
                        <!-- <check-box text="股静脉" :checked="isValueIndexOfCheck(record.assessment_before_dislysis, 'internal_fistula', '震颤-存在')"></check-box> -->
                        ） 内瘘皮肤情况：（&nbsp;
                        <check-box
                          text="正常"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_before_dislysis,
                              'internal_fistula_skin',
                              '正常'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="瘀斑"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_before_dislysis,
                              'internal_fistula_skin',
                              '瘀斑'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="红"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_before_dislysis,
                              'internal_fistula_skin',
                              '红'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="肿"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_before_dislysis,
                              'internal_fistula_skin',
                              '肿'
                            )
                          "
                        ></check-box>
                        ）
                      </div>
                    </div>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        导管：穿刺口 （&nbsp;
                        <check-box
                          text="干洁"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_before_dislysis,
                              'catheter',
                              '穿刺口-干洁'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="红肿"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_before_dislysis,
                              'catheter',
                              '穿刺口-红肿'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="分泌物"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_before_dislysis,
                              'catheter',
                              '穿刺口-分泌物'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="渗血"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_before_dislysis,
                              'catheter',
                              '穿刺口-渗血'
                            )
                          "
                        ></check-box>
                        ） 导管打折：（&nbsp;
                        <check-box
                          text="有"
                          :checked="
                            isCheckBoxChecked(
                              record.assessment_before_dislysis,
                              'catheter_bend',
                              1
                            )
                          "
                        ></check-box>
                        <check-box
                          text="无"
                          :checked="
                            isCheckBoxChecked(
                              record.assessment_before_dislysis,
                              'catheter_bend',
                              2
                            )
                          "
                        ></check-box>
                        ）
                      </div>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td width="25px">透<br />析<br />处<br />方</td>
                  <td>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        透析时间：
                        <div class="under_line" style="width: 30px;">
                          {{
                            record.prescription &&
                            record.prescription.dialysis_duration_hour
                              ? record.prescription.dialysis_duration_hour
                              : "0"
                          }}
                        </div>
                        h
                        <div class="under_line" style="width: 30px;">
                          {{
                            record.prescription &&
                            record.prescription.dialysis_duration_minute
                              ? record.prescription.dialysis_duration_minute
                              : "0"
                          }}
                        </div>
                        min
                      </div>
                      <div class="inline_block" style="margin-left: 30px;">
                        血流量：
                        <div class="under_line" style="width: 50px;">
                          {{
                            record.prescription &&
                            record.prescription.blood_flow_volume
                              ? record.prescription.blood_flow_volume
                              : ""
                          }}
                        </div>
                        ml/min
                      </div>
                      <div class="inline_block" style="margin-left: 20px;">
                        体重： 透前
                        <div class="under_line" style="width: 50px;">
                          {{
                            record.assessment_before_dislysis &&
                            record.assessment_before_dislysis.weight_before
                              ? record.assessment_before_dislysis.weight_before
                              : ""
                          }}
                        </div>
                        kg&nbsp; 干体重
                        <div class="under_line" style="width: 50px;">
                          {{
                            record.assessment_before_dislysis &&
                            record.assessment_before_dislysis.dry_weight
                              ? record.assessment_before_dislysis.dry_weight
                              : ""
                          }}
                        </div>
                        kg
                      </div>
                      <div class="inline_block" style="margin-left: 20px;">
                        目标超滤量：
                        <div class="under_line" style="width: 60px;">
                          {{
                            record.prescription &&
                            record.prescription.target_ultrafiltration
                              ? record.prescription.target_ultrafiltration
                              : ""
                          }}
                        </div>
                        ml
                      </div>
                    </div>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        抗凝方式：
                        <check-box
                          text="普通肝素"
                          :checked="
                            isCheckBoxChecked(
                              record.prescription,
                              'anticoagulant',
                              2
                            )
                          "
                        ></check-box>
                        （ 首剂
                        <div class="under_line" style="width: 30px;">
                          {{
                            isCheckBoxChecked(
                              record.prescription,
                              "anticoagulant",
                              2
                            )
                              ? record.prescription.anticoagulant_shouji
                              : ""
                          }}
                        </div>
                        mg&nbsp; 维持
                        <div class="under_line" style="width: 30px;">
                          {{
                            isCheckBoxChecked(
                              record.prescription,
                              "anticoagulant",
                              2
                            )
                              ? record.prescription.anticoagulant_weichi
                              : ""
                          }}
                        </div>
                        mg/h ）

                        <check-box
                          text="低分子肝素"
                          :checked="
                            isCheckBoxChecked(
                              record.prescription,
                              'anticoagulant',
                              3
                            )
                          "
                        ></check-box>
                        <div class="under_line" style="width: 40px;">
                          {{
                            isCheckBoxChecked(
                              record.prescription,
                              "anticoagulant",
                              3
                            )
                              ? record.prescription.anticoagulant_zongliang
                              : ""
                          }}
                        </div>
                        IU

                        <check-box
                          text="无肝素"
                          :checked="
                            isCheckBoxChecked(
                              record.prescription,
                              'anticoagulant',
                              1
                            )
                          "
                          style="margin-left: 10px;"
                        ></check-box>
                        其他方式
                        <div class="under_line" style="width: 140px;">
                          {{
                            record.prescription &&
                            record.prescription.anticoagulant > 3
                              ? anticoagulantName(record.prescription)
                              : ""
                          }}
                        </div>
                      </div>
                    </div>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        透析液配方：
                        <check-box
                          text="常规"
                          :checked="
                            isdialysateFormulatioCheck(
                              record.prescription,
                              '常规'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="低钙"
                          :checked="
                            isdialysateFormulatioCheck(
                              record.prescription,
                              '低钙'
                            )
                          "
                        ></check-box>
                        （1.25mmol/L）&nbsp;
                        <check-box
                          text="高钙"
                          :checked="
                            isdialysateFormulatioCheck(
                              record.prescription,
                              '高钙'
                            )
                          "
                        ></check-box>
                        （1.75mmol/L）&nbsp;
                        <check-box
                          text="低钠"
                          :checked="
                            isdialysateFormulatioCheck(
                              record.prescription,
                              '低钠'
                            )
                          "
                        ></check-box>
                        （135mmol/L）&nbsp;
                        <check-box
                          text="高钠"
                          :checked="
                            isdialysateFormulatioCheck(
                              record.prescription,
                              '高钠'
                            )
                          "
                        ></check-box>
                        （145mmol/L）&nbsp;
                      </div>
                    </div>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        置换量：
                        <div class="under_line" style="width: 40px;">
                          {{
                            record.prescription &&
                            record.prescription.replacement_total
                              ? record.prescription.replacement_total
                              : ""
                          }}
                        </div>
                        L
                      </div>
                      <div class="inline_block" style="margin-left: 10px;">
                        治疗方式：
                        <check-box
                          text="HD"
                          :checked="
                            isCheckBoxChecked(record.prescription, 'mode_id', 1)
                          "
                        ></check-box>
                        <check-box
                          text="HDF"
                          :checked="
                            isCheckBoxChecked(record.prescription, 'mode_id', 2)
                          "
                        ></check-box>
                        <check-box
                          text="HF"
                          :checked="
                            isCheckBoxChecked(record.prescription, 'mode_id', 5)
                          "
                        ></check-box>
                        <check-box
                          text="HP"
                          :checked="
                            isCheckBoxChecked(record.prescription, 'mode_id', 4)
                          "
                        ></check-box>
                        <check-box
                          text="HD+HP"
                          :checked="
                            isCheckBoxChecked(record.prescription, 'mode_id', 3)
                          "
                        ></check-box>
                        其他
                        <div class="under_line" style="width: 100px;">
                          {{
                            record.prescription &&
                            record.prescription.mode_id > 5
                              ? modeName(record.prescription.mode_id)
                              : ""
                          }}
                        </div>
                      </div>
                      <div class="inline_block" style="margin-left: 10px;">
                        透析器/灌流器型号：
                        <div class="under_line" style="width: 130px;">
                          {{
                            record.prescription
                              ? record.prescription.dialyzer_perfusion_apparatus
                              : ""
                          }}
                        </div>
                      </div>
                    </div>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        透析机号：
                        <div class="under_line" style="width: 150px;">
                          {{
                            record.device_zone ? record.device_zone.name : ""
                          }}
                          {{
                            record.dialysis_order &&
                            record.dialysis_order.device_number &&
                            record.dialysis_order.device_number.number.length >
                              0
                              ? record.dialysis_order.device_number.number
                              : record.device_number.number
                          }}
                          <!--{{record.device_number&&record.dialysis_order?record.device_number.number:''}}-->
                        </div>
                      </div>
                      <div class="inline_block" style="float: right;">
                        医生签名：
                        <div class="under_line" style="width: 100px;">
                          <span
                            v-if="
                              !record.advices ||
                                typeof record.advices[0] == 'undefined' ||
                                typeof record.advices[0][0] == 'undefined'
                            "
                          ></span>
                          <span
                            v-else-if="
                              setAdminUserES(
                                record.advices[0][0],
                                'advice_doctor'
                              ) == ''
                            "
                            >{{
                              getAdminUser(
                                record.advices[0][0],
                                "advice_doctor"
                              )
                            }}</span
                          >
                          <img
                            class="es-img"
                            :src="
                              setAdminUserES(
                                record.advices[0][0],
                                'advice_doctor'
                              )
                            "
                            alt=""
                            srcset=""
                            v-else
                            style="height: 20px;"
                          />

                          <!-- <img style="height: 20px;" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1552901663505&di=bf12bd343b552c6ccfb2ed12343a3141&imgtype=0&src=http%3A%2F%2Fd.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fe61190ef76c6a7ef7d58560df3faaf51f3de669b.jpg" /> -->
                        </div>
                        &nbsp;上机护士：
                        <div class="under_line" style="width: 100px;">
                          <span
                            v-if="
                              setAdminUserES(
                                record.dialysis_order,
                                'start_nurse'
                              ) == ''
                            "
                            >{{
                              getAdminUser(record.dialysis_order, "start_nurse")
                            }}</span
                          >
                          <img
                            class="es-img"
                            :src="
                              setAdminUserES(
                                record.dialysis_order,
                                'start_nurse'
                              )
                            "
                            alt=""
                            srcset=""
                            v-else
                            style="height: 20px;"
                          />
                        </div>
                      </div>
                    </div>
                  </td>
                </tr>
                <tr>
                  <!-- <td width="25px">
                    透<br/>析<br/>中<br/>记<br/>录
                </td> -->
                  <td style="padding: 0;" colspan="2">
                    <table class="inside_table">
                      <tbody>
                        <!-- <thead> -->
                        <tr>
                          <td
                            :rowspan="record.monitor_records.length + 2"
                            width="30px"
                            style="font-size:16px;padding:8px 8px;"
                          >
                            透析中记录
                          </td>
                          <td width="100">时间</td>
                          <td width="80">血压<br />mmHg</td>
                          <td width="60">脉率<br />次/分</td>
                          <td width="60">呼吸<br />次/分</td>
                          <td width="60">血流量<br />ml/min</td>
                          <td width="60">超滤量<br />L</td>
                          <td width="60">置换量<br />L</td>
                          <td width="60">静脉压<br />mmHg</td>
                          <td width="60">跨膜压<br />mmHg</td>
                          <td width="60">电导度<br />mS/m</td>
                          <td width="200">
                            病情特殊处理<br />及专科护理措施纪录
                          </td>
                          <td width="80">护士签名</td>
                        </tr>
                        <!-- </thead>
                    <tbody> -->
                        <tr
                          v-for="(monitor_record,
                          index) in record.monitor_records"
                          :key="index"
                        >
                          <td>
                            {{
                              getTime(monitor_record.operate_time, "{h}:{i}")
                            }}
                          </td>
                          <td>
                            {{
                              monitor_record.systolic_blood_pressure
                                ? monitor_record.systolic_blood_pressure
                                : ""
                            }}
                            /
                            {{
                              monitor_record.diastolic_blood_pressure
                                ? monitor_record.diastolic_blood_pressure
                                : ""
                            }}
                          </td>
                          <td>
                            {{
                              monitor_record.pulse_frequency
                                ? monitor_record.pulse_frequency
                                : ""
                            }}
                          </td>
                          <td>
                            {{
                              monitor_record.breathing_rate
                                ? monitor_record.breathing_rate
                                : ""
                            }}
                          </td>
                          <td>
                            {{
                              monitor_record.blood_flow_volume
                                ? monitor_record.blood_flow_volume
                                : ""
                            }}
                          </td>
                          <td>
                            {{
                              monitor_record.ultrafiltration_volume
                                ? monitor_record.ultrafiltration_volume
                                : ""
                            }}
                          </td>
                          <td>
                            {{
                              monitor_record.displacement_quantity
                                ? monitor_record.displacement_quantity
                                : ""
                            }}
                          </td>
                          <td>
                            {{
                              monitor_record.venous_pressure
                                ? monitor_record.venous_pressure
                                : ""
                            }}
                          </td>
                          <td>
                            {{
                              monitor_record.transmembrane_pressure
                                ? monitor_record.transmembrane_pressure
                                : ""
                            }}
                          </td>
                          <td>
                            {{
                              monitor_record.conductivity
                                ? monitor_record.conductivity
                                : ""
                            }}
                          </td>
                          <td>
                            {{ monitor_record.symptom }}
                            &nbsp;{{ monitor_record.dispose }} &nbsp;{{
                              monitor_record.result
                            }}
                          </td>
                          <td>
                            <span
                              v-if="
                                setAdminUserES(
                                  monitor_record.monitoring_nurse
                                ) == ''
                              "
                              >{{
                                getAdminUser(monitor_record.monitoring_nurse)
                              }}</span
                            >
                            <img
                              class="es-img"
                              :src="
                                setAdminUserES(monitor_record.monitoring_nurse)
                              "
                              alt=""
                              srcset=""
                              v-else
                            />
                          </td>
                        </tr>
                        <tr>
                          <td
                            colspan="12"
                            align="left"
                            valign="top"
                            style="text-align:left;padding:0 5px;height:120px;"
                          >
                            护士小结:{{
                              record.summer &&
                              record.summer.dialysis_summary.length > 0
                                ? record.summer.dialysis_summary
                                : ""
                            }}
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </td>
                </tr>
                <tr>
                  <td width="25px">透<br />后<br />评<br />估</td>
                  <td>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        实际治疗时间：
                        <div class="under_line" style="width: 30px;">
                          {{
                            record.assessment_after_dislysis &&
                            record.assessment_after_dislysis
                              .actual_treatment_hour
                              ? record.assessment_after_dislysis
                                  .actual_treatment_hour
                              : "0"
                          }}
                        </div>
                        h
                        <div class="under_line" style="width: 30px;">
                          {{
                            record.assessment_after_dislysis &&
                            record.assessment_after_dislysis
                              .actual_treatment_minute
                              ? record.assessment_after_dislysis
                                  .actual_treatment_minute
                              : "0"
                          }}
                        </div>
                        min
                      </div>
                      <div class="inline_block" style="margin-left: 15px;">
                        实际超滤量：
                        <div class="under_line" style="width: 40px;">
                          {{
                            record.assessment_after_dislysis &&
                            record.assessment_after_dislysis
                              .actual_ultrafiltration
                              ? record.assessment_after_dislysis
                                  .actual_ultrafiltration
                              : ""
                          }}
                        </div>
                        ml
                      </div>
                      <div class="inline_block" style="margin-left: 15px;">
                        透后体重：
                        <div class="under_line" style="width: 40px;">
                          {{
                            record.assessment_after_dislysis &&
                            record.assessment_after_dislysis.weight_after
                              ? record.assessment_after_dislysis.weight_after
                              : ""
                          }}
                        </div>
                        kg
                      </div>
                      <div class="inline_block" style="margin-left: 20px;">
                        透析器凝血：
                        <check-box
                          text="0级"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'cruor',
                              '0度'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="Ⅰ级"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'cruor',
                              'Ⅰ度'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="Ⅱ级"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'cruor',
                              'Ⅱ度'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="Ⅲ级"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'cruor',
                              'Ⅲ度'
                            )
                          "
                        ></check-box>
                      </div>
                    </div>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        拔针后穿刺点渗血：
                        <check-box
                          text="有"
                          :checked="
                            isCheckBoxChecked(
                              record.assessment_after_dislysis,
                              'puncture_point_oozing_blood',
                              1
                            )
                          "
                        ></check-box>
                        <check-box
                          text="无"
                          :checked="
                            isCheckBoxChecked(
                              record.assessment_after_dislysis,
                              'puncture_point_oozing_blood',
                              2
                            )
                          "
                        ></check-box>
                      </div>
                      <div class="inline_block" style="margin-left: 40px;">
                        穿刺点血肿：
                        <check-box
                          text="有"
                          :checked="
                            isCheckBoxChecked(
                              record.assessment_after_dislysis,
                              'puncture_point_haematoma',
                              1
                            )
                          "
                        ></check-box>
                        <check-box
                          text="无"
                          :checked="
                            isCheckBoxChecked(
                              record.assessment_after_dislysis,
                              'puncture_point_haematoma',
                              2
                            )
                          "
                        ></check-box>
                      </div>
                      <div class="inline_block" style="margin-left: 40px;">
                        压迫后内瘘震颤：
                        <check-box
                          text="存在"
                          :checked="
                            record.assessment_after_dislysis.internal_fistula.indexOf('存在') > -1
                              ? true
                              : false
                          "
                        ></check-box>
                        <check-box
                          text="减弱"
                          :checked="
                            record.assessment_after_dislysis.internal_fistula.indexOf('减弱') > -1
                              ? true
                              : false
                          "
                        ></check-box>
                        <check-box
                          text="不存在"
                          :checked="
                             record.assessment_after_dislysis.internal_fistula.indexOf('不存在') > -1
                              ? true
                              : false
                          "
                        ></check-box>
                      </div>
                    </div>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block">
                        并发症：
                        <check-box
                          text="低血压"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'complication',
                              '低血压'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="高血压"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'complication',
                              '高血压'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="心律失常"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'complication',
                              '心律失常'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="头晕"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'complication',
                              '头晕'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="头痛"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'complication',
                              '头痛'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="呕吐"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'complication',
                              '呕吐'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="抽搐"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'complication',
                              '抽搐'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="出血"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'complication',
                              '出血'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="心衰"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'complication',
                              '心衰'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="腹痛"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'complication',
                              '腹痛'
                            )
                          "
                        ></check-box>
                        <check-box
                          text="无"
                          :checked="
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'complication',
                              '无'
                            )
                          "
                        ></check-box>
                      </div>
                    </div>

                    <div class="row" style="padding: 2px 0;">
                      患者去向：
                      <check-box
                        text="离院"
                        :checked="
                          isCheckBoxChecked(
                            record.assessment_after_dislysis,
                            'patient_gose',
                            1
                          )
                        "
                      ></check-box>
                      <check-box
                        text="留观"
                        :checked="
                          isCheckBoxChecked(
                            record.assessment_after_dislysis,
                            'patient_gose',
                            2
                          )
                        "
                      ></check-box>
                      <check-box
                        text="住院"
                        :checked="
                          isCheckBoxChecked(
                            record.assessment_after_dislysis,
                            'patient_gose',
                            3
                          )
                        "
                      ></check-box>
                      （ 科室
                      <div class="under_line" style="width: 200px;"></div>
                      交待病房护士/患者/陪人观察内容：
                      <check-box
                        text="意识状态"
                        :checked="
                          isCheckBoxChecked(
                            record.assessment_after_dislysis,
                            'patient_gose',
                            3
                          ) &&
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'observation_content',
                              '意识状态'
                            )
                        "
                      ></check-box>
                      <check-box
                        text="生命体征"
                        :checked="
                          isCheckBoxChecked(
                            record.assessment_after_dislysis,
                            'patient_gose',
                            3
                          ) &&
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'observation_content',
                              '生命体征'
                            )
                        "
                      ></check-box>
                    </div>
                    <!-- 接“交待病房护士/患者/陪人观察内容” -->
                    <div class="row" style="padding: 2px 0;">
                      <check-box
                        text="内瘘搏动/渗血"
                        :checked="
                          isCheckBoxChecked(
                            record.assessment_after_dislysis,
                            'patient_gose',
                            3
                          ) &&
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'observation_content',
                              '内瘘搏动/渗血'
                            )
                        "
                      ></check-box>
                      <check-box
                        text="导管固定/穿刺口渗血"
                        :checked="
                          isCheckBoxChecked(
                            record.assessment_after_dislysis,
                            'patient_gose',
                            3
                          ) &&
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'observation_content',
                              '导管固定/穿刺口渗血'
                            )
                        "
                      ></check-box>
                      <check-box
                        text="动静脉直接穿刺口渗血/肢端循环情况"
                        :checked="
                          isCheckBoxChecked(
                            record.assessment_after_dislysis,
                            'patient_gose',
                            3
                          ) &&
                            isValueIndexOfCheck(
                              record.assessment_after_dislysis,
                              'observation_content',
                              '动静脉直接穿刺口渗血/肢端循环情况'
                            )
                        "
                      ></check-box>
                      &nbsp;其他：
                      <div class="under_line" style="width: 290px;">
                        {{
                          isCheckBoxChecked(
                            record.assessment_after_dislysis,
                            "patient_gose",
                            3
                          )
                            ? record.assessment_after_dislysis
                                .observation_content_other
                            : ""
                        }}
                      </div>
                      ）
                    </div>
                    <div class="row" style="padding: 2px 0;">
                      <div class="inline_block" style="float: left;">
                        当班责任（核对）护士：
                        <div class="under_line" style="width: 100px;">
                          <span
                            v-if="
                              setAdminUserES(
                                record.assessment_after_dislysis,
                                'creater'
                              ) == ''
                            "
                            >{{
                              getAdminUser(
                                record.assessment_after_dislysis,
                                "creater"
                              )
                            }}</span
                          >
                          <img
                            class="es-img"
                            :src="
                              setAdminUserES(
                                record.assessment_after_dislysis,
                                'creater'
                              )
                            "
                            alt=""
                            srcset=""
                            v-else
                            style="height: 20px;"
                          />
                        </div>
                      </div>
                      <div class="inline_block" style="float: right;">
                        下机护士：
                        <div class="under_line" style="width: 100px;">
                          <span
                            v-if="
                              setAdminUserES(
                                record.dialysis_order,
                                'finish_nurse'
                              ) == ''
                            "
                            >{{
                              getAdminUser(
                                record.dialysis_order,
                                "finish_nurse"
                              )
                            }}</span
                          >
                          <img
                            class="es-img"
                            :src="
                              setAdminUserES(
                                record.dialysis_order,
                                'finish_nurse'
                              )
                            "
                            alt=""
                            srcset=""
                            v-else
                            style="height: 20px;"
                          />
                        </div>
                      </div>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td colspan="2" style="padding: 0;">
                    <table class="inside_table">
                      <thead>
                        <tr>
                          <td width="40px">时间</td>
                          <td width="120px">医嘱内容</td>
                          <td width="80px">医生签名</td>
                          <td width="80px">执行护士</td>
                          <td width="65px">执行时间</td>
                          <td width="75px">核对护士</td>
                          <td width="10px"></td>
                          <td width="40px">时间</td>
                          <td width="120px">医嘱内容</td>
                          <td width="80px">医生签名</td>
                          <td width="80px">执行护士</td>
                          <td width="65px">执行时间</td>
                          <td width="75px">核对护士</td>

                          <!-- <td width="100">时间</td>
                      <td>医嘱内容</td>
                      <td width="120">医生签名</td>
                      <td width="120">执行护士</td>
                      <td width="100">执行时间</td>
                      <td width="120">核对护士</td> -->
                        </tr>
                      </thead>
                      <tbody>
                        <tr
                          v-for="(advice, index) in record.advices"
                          :key="index"
                        >
                          <td>
                            <span v-if="advice[0] && advice[0].start_time">
                              {{ getTime(advice[0].start_time, "{h}:{i}") }}
                            </span>
                            <span v-else>&nbsp;<br />&nbsp;</span>
                          </td>
                          <td class="advice-name">
                            <span v-if="advice[0].parent_id > 0">└</span>
                            <span>{{ advice[0].advice_name }}</span>
                            <span
                              >{{ advice[0].advice_desc
                              }}{{ advice[0].drug_spec_unit }}</span
                            >
                            <!-- <span v-if="advice[0].drug_spec">{{advice[0].drug_spec}}{{advice[0].drug_spec_unit}}</span> -->
                            <span v-if="advice[0].prescribing_number"
                              >* {{ advice[0].prescribing_number
                              }}{{ advice[0].prescribing_number_unit }}</span
                            >
                            <span v-if="advice[0].single_dose != 0"
                              >单次用量 {{ advice[0].single_dose
                              }}{{ advice[0].single_dose_unit }}</span
                            >
                            <span>{{ advice[0].delivery_way }}</span>
                            <span>{{ advice[0].execution_frequency }}</span>
                            <div
                              v-for="(child, childindex) in advice[0].children"
                              :key="childindex"
                              class="advice-children"
                            >
                              <div>▲</div>
                              <div>
                                <span>{{ child.advice_name }}</span>
                                <span>{{ child.advice_desc }}</span>
                                <span v-if="child.drug_spec"
                                  >{{ child.drug_spec
                                  }}{{ child.drug_spec_unit }}</span
                                >
                                <span v-if="child.prescribing_number"
                                  >* {{ child.prescribing_number
                                  }}{{ child.prescribing_number_unit }}</span
                                >
                                <span v-if="child.single_dose != 0"
                                  >单次用量 {{ child.single_dose
                                  }}{{ child.single_dose_unit }}</span
                                >
                              </div>
                            </div>
                          </td>
                          <td>
                            <span
                              v-if="
                                setAdminUserES(advice[0], 'advice_doctor') == ''
                              "
                              >{{
                                getAdminUser(advice[0], "advice_doctor")
                              }}</span
                            >
                            <img
                              class="es-img"
                              :src="setAdminUserES(advice[0], 'advice_doctor')"
                              alt=""
                              srcset=""
                              v-else
                              style="height: 20px;"
                            />
                          </td>
                          <td>
                            <span
                              v-if="
                                setAdminUserES(advice[0], 'execution_staff') ==
                                  ''
                              "
                              >{{
                                getAdminUser(advice[0], "execution_staff")
                              }}</span
                            >
                            <img
                              class="es-img"
                              :src="
                                setAdminUserES(advice[0], 'execution_staff')
                              "
                              alt=""
                              srcset=""
                              v-else
                              style="height: 20px;"
                            />
                          </td>
                          <td>
                            <span v-if="advice[0].execution_time">
                              {{ getTime(advice[0].execution_time, "{h}:{i}") }}
                            </span>
                          </td>
                          <td>
                            <span
                              v-if="setAdminUserES(advice[0], 'checker') == ''"
                              >{{ getAdminUser(advice[0], "checker") }}</span
                            >
                            <img
                              class="es-img"
                              :src="setAdminUserES(advice[0], 'checker')"
                              alt=""
                              srcset=""
                              v-else
                              style="height: 20px;"
                            />
                          </td>
                          <td></td>
                          <td>
                            <span v-if="advice[1] && advice[1].start_time">
                              {{ getTime(advice[1].start_time, "{h}:{i}") }}
                            </span>
                            <span v-else>&nbsp;<br />&nbsp;</span>
                          </td>
                          <td class="advice-name">
                            <span v-if="advice[1].parent_id > 0">└</span>
                            <span>{{ advice[1].advice_name }}</span>
                            <span
                              >{{ advice[1].advice_desc
                              }}{{ advice[1].drug_spec_unit }}</span
                            >
                            <!-- <span v-if="advice[1].drug_spec">{{advice[1].drug_spec}}{{advice[1].drug_spec_unit}}</span> -->
                            <span v-if="advice[1].prescribing_number"
                              >* {{ advice[1].prescribing_number
                              }}{{ advice[1].prescribing_number_unit }}</span
                            >
                            <span v-if="advice[1].single_dose"
                              >单次用量 {{ advice[1].single_dose
                              }}{{ advice[1].single_dose_unit }}</span
                            >
                            <span>{{ advice[1].delivery_way }}</span>
                            <span>{{ advice[1].execution_frequency }}</span>
                            <div
                              v-for="(child, childindex) in advice[1].children"
                              :key="childindex"
                              class="advice-children"
                            >
                              <div>▲</div>
                              <div>
                                <span>{{ child.advice_name }}</span>
                                <span>{{ child.advice_desc }}</span>
                                <span v-if="child.drug_spec"
                                  >{{ child.drug_spec
                                  }}{{ child.drug_spec_unit }}</span
                                >
                                <span v-if="child.prescribing_number"
                                  >* {{ child.prescribing_number
                                  }}{{ child.prescribing_number_unit }}</span
                                >
                                <span v-if="child.single_dose != 0"
                                  >单次用量 {{ child.single_dose
                                  }}{{ child.single_dose_unit }}</span
                                >
                              </div>
                            </div>
                          </td>
                          <td>
                            <span
                              v-if="
                                setAdminUserES(advice[1], 'advice_doctor') == ''
                              "
                              >{{
                                getAdminUser(advice[1], "advice_doctor")
                              }}</span
                            >
                            <img
                              class="es-img"
                              :src="setAdminUserES(advice[1], 'advice_doctor')"
                              alt=""
                              srcset=""
                              v-else
                              style="height: 20px;"
                            />
                          </td>
                          <td>
                            <span
                              v-if="
                                setAdminUserES(advice[1], 'execution_staff') ==
                                  ''
                              "
                              >{{
                                getAdminUser(advice[1], "execution_staff")
                              }}</span
                            >
                            <img
                              class="es-img"
                              :src="
                                setAdminUserES(advice[1], 'execution_staff')
                              "
                              alt=""
                              srcset=""
                              v-else
                              style="height: 20px;"
                            />
                          </td>
                          <td>
                            <span v-if="advice[1].execution_time">
                              {{ getTime(advice[1].execution_time, "{h}:{i}") }}
                            </span>
                          </td>
                          <td>
                            <span
                              v-if="setAdminUserES(advice[1], 'checker') == ''"
                              >{{ getAdminUser(advice[1], "checker") }}</span
                            >
                            <img
                              class="es-img"
                              :src="setAdminUserES(advice[1], 'checker')"
                              alt=""
                              srcset=""
                              v-else
                              style="height: 20px;"
                            />
                          </td>
                        </tr>
                        <!-- 使整个表有5行以上 -->
                        <!-- <template v-if="record.advices.length < 1">
                    <tr v-for="(num) in (5 - record.advices.length)" :key="'5_' + num">
                        <td>&nbsp;</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>&nbsp;</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                    </template> -->
                      </tbody>
                    </table>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
          <div class="row">
            注：透析器凝血评价标准：“0 级” 无凝血或数条纤维束凝血，“Ⅰ 级”
            少于10%纤维凝血，“Ⅱ 级” 少于50%纤维凝血，“Ⅲ 级” 大于50%纤维凝血。
          </div>
          <div class="table-box" style="margin-top: 20px;float:right;">
            患者/家属签字:
            <div class="under_line" style="width: 100px;">
              <span></span>
            </div>
          </div>
          <div style="position: absolute;top:1380px;left:50%;">1</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import CheckBox from "./option_check_box";
import { GetBatchPrintDialysisData } from "@/api/print_data";
import { jsGetAge, uParseTime } from "@/utils/tools";
import { getDataConfig } from "@/utils/data";
import BreadCrumb from "@/xt_pages/components/bread-crumb";
import print from "print-js";
export default {
  name: "BatchPrintOrder",
  components: {
    CheckBox,
    BreadCrumb
  },
  data() {
    return {
      crumbs: [
        { path: false, name: "透析管理" },
        { path: false, name: "批量打印" }
      ],
      records: [
        // 模拟有多条数据
        // {
        //     monitor_records: [ {},{},{},{},{},{},{},{},{},{},{}, ],
        //     advices: [ {},{},{},{},{},{},{}, ],
        // },
        // {
        //     monitor_records: [],
        //     advices: [],
        // },
      ],

      way_arr: [],
      consciousness_arr: [],
      appetite_arr: [],
      posture_arr: [],
      sick_condition_arr: [],
      precaution_arr: [],
      intake_arr: [],
      nutrition_arr: [],

      loading: false,
      orgname: "",
      bloodAccessParOpera: {},
      anticoagulantsConfit: {},
      dialysateFormulationOptions: {},
      operatorMaps: {},
      operators: [],
      adminUser: [],
      complications: [
        "低血压",
        "高血压",
        "心律失常",
        "头晕",
        "头痛",
        "呕吐",
        "抽搐",
        "出血",
        "心衰",
        "腹痛"
      ]
    };
  },
  created() {
    this.way_arr = getDataConfig("hemodialysis", "way");
    this.consciousness_arr = getDataConfig("hemodialysis", "consciousness");
    this.appetite_arr = getDataConfig("hemodialysis", "appetite");
    this.posture_arr = getDataConfig("hemodialysis", "posture");
    this.sick_condition_arr = getDataConfig("hemodialysis", "sick_condition");
    this.precaution_arr = getDataConfig("hemodialysis", "precaution");
    this.intake_arr = getDataConfig("hemodialysis", "intake");
    this.nutrition_arr = getDataConfig("hemodialysis", "nutrition");

    var xtuser = this.$store.getters.xt_user;
    this.orgname = xtuser.org.org_name;
    //   this.orgname = "遂溪方济医院";
    this.modeOptions = this.$store.getters.treatment_mode;
    //   this.replacementWays = this.$store.getters.replacement_ways;
    //   this.perfusionApparatus = this.$store.getters.perfusion_apparatus;
    this.anticoagulantsConfit = this.$store.getters.anticoagulants_confit;

    var bloodAccessParOpera = getDataConfig(
      "hemodialysis",
      "vascular_access_desc"
    );
    for (var key in bloodAccessParOpera) {
      this.bloodAccessParOpera[bloodAccessParOpera[key].id] =
        bloodAccessParOpera[key];
    }

    var dialysateFormulationOptions = getDataConfig(
      "hemodialysis",
      "dialysate_formulation"
    );
    for (var key in dialysateFormulationOptions) {
      this.dialysateFormulationOptions[dialysateFormulationOptions[key].id] =
        dialysateFormulationOptions[key];
    }

    //   const xtdate = this.$route.query && this.$route.query.xtdate;
    //   const xtno = this.$route.query && this.$route.query.xtno;
    //   if (typeof (xtdate) == "string" && xtdate.length > 0 && typeof (xtno) == "string" && xtno.length > 0) {
    //     this.queryParams.xtdate = xtdate;
    //     this.queryParams.xtno = xtno;
    //     this.getDialysisRecord();
    //   } else {
    //     this.$message.error("参数不齐");
    //     return false;
    //   }
  },
  mounted() {
    this.loading = true;
    var ids = this.$store.getters.temp_params.batch_print_dialysis_record_ids;
    if (ids.length == 0) {
      this.$router.back(-1);
      return;
    }
    GetBatchPrintDialysisData(ids.join(","))
      .then(rs => {
        var resp = rs.data;
        if (resp.state == 1) {
          this.records = this.records.concat(resp.data.schedules);
          for (const recordIndex in this.records) {
            var dlegh = 0;
            if (
              this.records[recordIndex].monitor_records &&
              this.records[recordIndex].monitor_records.length < 8
            ) {
              dlegh = 8 - this.records[recordIndex].monitor_records.length;
            } else {
              dlegh = 8;
            }
            if (dlegh > 0) {
              if (
                typeof this.records[recordIndex].monitor_records ===
                  "undefined" ||
                this.records[recordIndex].monitor_records == null
              ) {
                this.records[recordIndex].monitor_records = [];
              }
              for (let index = 0; index < dlegh; index++) {
                this.records[recordIndex].monitor_records.push([]);
              }
            }

            var childMap = {};
            for (const index in this.records[recordIndex].advices) {
              if (this.records[recordIndex].advices[index].parent_id == 0) {
                continue;
              }
              if (
                !(
                  this.records[recordIndex].advices[index].parent_id in childMap
                )
              ) {
                childMap[
                  this.records[recordIndex].advices[index].parent_id
                ] = [];
              }
              childMap[this.records[recordIndex].advices[index].parent_id].push(
                this.records[recordIndex].advices[index]
              );
            }

            var advices = [];
            for (const index in this.records[recordIndex].advices) {
              if (this.records[recordIndex].advices[index].parent_id > 0) {
                continue;
              }
              var item = this.records[recordIndex].advices[index];
              if (item.id in childMap) {
                item.children = childMap[item.id];
              } else {
                item.children = [];
              }
              advices.push(item);
            }

            var leftAdvice = [];
            var rightAdvice = [];
            var adlen = advices.length;

            var halfLen = adlen % 2 == 0 ? adlen / 2 : (adlen + 1) / 2;
            for (var i = 0; i < halfLen; i++) {
              leftAdvice.push(advices[i]);
              var rightIndex = i + halfLen;
              rightAdvice.push(
                rightIndex in advices ? advices[i + halfLen] : []
              );
            }
            if (halfLen < 5) {
              var nl = 5 - leftAdvice.length;
              for (let index = 0; index < nl; index++) {
                leftAdvice.push([]);
              }
              var nl = 5 - rightAdvice.length;
              for (let index = 0; index < nl; index++) {
                rightAdvice.push([]);
              }
            }

            this.records[recordIndex].advices = [];
            for (var i = 0; i < halfLen; i++) {
              var item = [];
              item.push(leftAdvice[i]);
              item.push(rightAdvice[i]);
              this.records[recordIndex].advices.push(item);
            }
          }

          console.log(" this.records[recordIndex].advices", this.records);
          this.operators = resp.data.medical_staffs;
          if (this.operators.length > 0) {
            var operatorsLen = this.operators.length;
            for (var index = 0; index < operatorsLen; index++) {
              this.$set(
                this.operatorMaps,
                this.operators[index].id,
                this.operators[index]
              );
            }
          }

          this.adminUser = resp.data.users;
          this.loading = false;
        } else {
          this.loading = false;
          this.$message.error(resp.msg);
        }
      })
      .catch(err => {
        this.$message.error(err);
      });
  },
  methods: {
    printAction: function() {
      const style =
        '@media print { .option_panel { margin: 0 5px 0 0; } .option_panel .check_box_panel { white-space: nowrap; outline: none; display: inline-block; line-height: 1; position: relative; vertical-align: middle; } .option_panel .check_box_panel .check_box { display: inline-block; position: relative; border: 1px solid #000; box-sizing: border-box; width: 14px; height: 14px; background-color: #fff; } .check_box_panel .did_checked::after { content: "√"; font-size: 15px; } .print_page_main_content { background-color: white; width:960px; margin:0 auto; padding: 0 0 0 0; page-break-after: always; } .print_page_main_content .order-yy-name { margin: auto; text-align: center; font-size: 20px; letter-spacing: 5px;} .print_page_main_content .order_title { text-align: center; font-size: 23px; line-height: 50px; font-weight: 500; } .row { font-size: 14px; line-height: 20px; padding: 5px 0; } .inline_block { display: inline-block; } .under_line { display: inline-block; border-bottom: 1px solid #999; text-align: center; white-space: nowrap; } .under_line::before { content: "\\00A0"; } .under_line::after { content: "\\00A0"; } .flex { display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; align-items: center; -webkit-align-items: center; box-align: center; -moz-box-align: center; -webkit-box-align: center; text-align: center; -webkit-justify-content: space-between; justify-content: space-between; -moz-box-pack: space-between; -webkit--moz-box-pack: space-between; box-pack: space-between; } .print_page_main_content .proj_table { width: 100%; border: 1px solid; border-collapse: collapse; padding: 2px; } .print_page_main_content .proj_table tbody tr td { border: 1px solid; font-size: 16px; padding: 10px 8px; line-height: 30px; } .print_page_main_content .proj_table .inside_table { width: 100%; border: hidden; border-collapse: collapse; } .print_page_main_content .proj_table .inside_table tr td { border: 1px solid; text-align: center; font-size: 14px; padding: 8px 5px; line-height: 25px; } }.es-img{height: 20px; }.advice-name{text-align: left !important;line-height: 16px !important;}.advice-children{display:flex;}.did_checke::after {font-size: 8px;margin-left: 2px;margin-top: 2px;position: absolute;}';

      printJS({
        printable: "print_content",
        type: "html",
        documentTitle: "  ",
        style: style,
        scanStyles: false
      });
    },

    complicationsOther: function(record) {
      if (record == null || typeof record === "undefined") {
        return "";
      }
      if (record.complication.length == 0) {
        return "";
      }
      var complications = record.complication.split(",");
      var complicationOthers = [];
      for (const index in complications) {
        if (
          this.complications.indexOf(complications[index]) < 0 &&
          complicationOthers.indexOf(complications[index]) < 0
        ) {
          complicationOthers.push(complications[index]);
        }
      }
      return complicationOthers.join(",");
    },
    modeName(mode_id) {
      if (mode_id in this.modeOptions) {
        return this.modeOptions[mode_id].name;
      }
      return "";
    },
    anticoagulantName: function(key) {
      if (key == null || typeof key === "undefined") {
        return "";
      }
      var id = key.anticoagulant;
      if (id in this.anticoagulantsConfit) {
        return this.anticoagulantsConfit[id].name;
      }
      return "";
    },
    isBbloodAccessParOperaCheck(key, value) {
      if (key == null || typeof key === "undefined") {
        return false;
      }
      var id = key.blood_access_part_opera_id;
      if (id in this.bloodAccessParOpera) {
        return this.bloodAccessParOpera[id].name.indexOf(value) > -1;
      }
      return false;
    },
    isdialysateFormulatioCheck(key, value) {
      if (key == null || typeof key === "undefined") {
        return false;
      }
      var id = key.dialysate_formulation;
      if (id in this.dialysateFormulationOptions) {
        return this.dialysateFormulationOptions[id].name.indexOf(value) > -1;
      }
      return false;
    },
    isValueIndexOfCheck: function(record, key, value) {
      if (record == null || record == undefined) {
        return false;
      } else {
        return record[key].indexOf(value) > -1;
      }
    },
    setAdminUserES(key, id) {
      if (
        typeof key === "undefined" ||
        key == null ||
        typeof key[id] === "undefined"
      ) {
        return "";
      }
      if (key[id] == 0) {
        return "";
      }
      if (key[id] in this.operatorMaps) {
        return this.operatorMaps[key[id]].es_url;
      } else {
        return "";
      }
    },
    getAdminUser(key, id) {
      console.log("key", key);
      console.log("id", id);
      if (
        typeof key === "undefined" ||
        key == null ||
        typeof key[id] === "undefined"
      ) {
        return "";
      }
      if (key[id] == 0) {
        return "";
      }
      if (key[id] == undefined) {
        return "";
      }
      for (let i = 0; i < this.adminUser.length; i++) {
        if (this.adminUser[i].id == key[id]) {
          return this.adminUser[i].name;
        }
      }
    },
    jsGetAge: function(agetime) {
      if (agetime == 0) {
        return "";
      }
      return jsGetAge(uParseTime(agetime, "{y}-{m}-{d}"), "-");
    },
    getTime(value, temp) {
      if (value != undefined) {
        return uParseTime(value, temp);
      }
      return "";
    },
    // 函数说明：因为一次透析记录有些记录不一定是必须填的，比如 record.receive_assessment 可能为 null，所以要取 record.receive_assessment.way 前需要判断 record.receive_assessment 是否为 null，所以这个方法用来简化模板渲染的代码
    // 参数说明：比如判断 record.receive_assessment.way 是不是为1，参数为 (record.receive_assessment, way, 1)
    isCheckBoxChecked: function(record, key, target_value) {
      if (record == null || record == undefined) {
        return false;
      } else {
        return record[key] == target_value;
      }
    }
  }
};
</script>

<style scoped>
.print_page_main_content {
  background-color: white;
  width: 960px;
  margin: 0 auto 50px;
  padding: 0 0 0 0;
  page-break-after: always;
}

.print_page_main_content .order-yy-name {
  margin: auto;
  text-align: center;
  font-size: 20px;
  letter-spacing: 5px;
}

.print_page_main_content .order_title {
  text-align: center;
  font-size: 23px;
  line-height: 50px;
  font-weight: 500;
}

.row {
  font-size: 14px;
  line-height: 20px;
  padding: 5px 0;
}

.inline_block {
  display: inline-block;
}

.under_line {
  display: inline-block;
  border-bottom: 1px solid #999;
  text-align: center;
}

.under_line::before {
  content: "\00A0";
}

.under_line::after {
  content: "\00A0";
}

.flex {
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  align-items: center;
  -webkit-align-items: center;
  box-align: center;
  -moz-box-align: center;
  -webkit-box-align: center;
  text-align: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -moz-box-pack: space-between;
  -webkit--moz-box-pack: space-between;
  box-pack: space-between;
}

.print_page_main_content .proj_table {
  width: 100%;
  border: 1px solid;
  border-collapse: collapse;
  padding: 2px;
}

.print_page_main_content .proj_table tbody tr td {
  border: 1px solid;
  /* text-align: center; */
  font-size: 16px;
  padding: 10px 8px;
  line-height: 30px;
}

.print_page_main_content .proj_table .inside_table {
  width: 100%;
  border: hidden; /* 解决边框冲突 */
  border-collapse: collapse;
}

.print_page_main_content .proj_table .inside_table tr td {
  border: 1px solid;
  text-align: center;
  font-size: 14px;
  padding: 8px 5px;
  line-height: 25px;
}

.es-img {
  height: 25px;
}

.advice-name {
  text-align: left !important;
  line-height: 16px !important;
}

.advice-children {
  display: flex;
}
.did_checke::after {
  content: "\221A";
  font-size: 8px;
  margin-left: 2px;
  margin-top: 2px;
  position: absolute;
}
</style>
