<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="printThisPage"
        type="primary"
        >打印
      </el-button>
    </div>
    <div class="app-container">
      <div id="print_content">
        <div
          v-for="(record, index) in records"
          :key="record.id"
          class="print_page_main_content"
        >
          <div id="dialysis-print-box-1"  style="page-break-after:always">
            <div
                id="dialysis-print-box-1-1"
                class="dialysis-print-order print-template-two print_page_main_content"
            >
                <div class="order-yy-name" style="font-weight:bold;font-size:28px;">{{ orgname }}</div>
                <div style="display:inline-block;width:100%;text-align:center;">
                    <div
                    class="order-title"
                    style="letter-spacing: 0;font-weight:600;font-size:22px;display:inline-block;"
                    >
                    血液净化治疗记录单
                    </div>
                </div>
                <div class="row" style="border-bottom:1px solid #000;">
                    <div class="inline_block">
                        透析号：
                        <div class="under_line" style="width: 70px;text-align: center;">
                            {{ record.patient.dialysis_no }}
                        </div>
                    </div>
                    <div class="inline_block">
                        姓名：
                        <div class="under_line" style="width: 70px;text-align: center;">
                            {{ record.patient.name }}
                        </div>
                    </div>
                    <div class="inline_block" style="margin-left: 10px;">
                        性别：
                        <div class="under_line" style="width: 50px;text-align: center;">
                            {{ record.patient.gender == 1 ? "男" : "女" }}
                        </div>
                    </div>
                    <div class="inline_block" style="margin-left: 10px;">
                        年龄：
                        <div class="under_line" style="width: 50px;text-align: center;">
                            {{ getNewAge(record.patient.id_card_no) }}
                        </div>
                    </div>
                    <div class="inline_block" style="margin-left: 10px;">
                        透析日期：
                        <div class="under_line" style="width: 90px;text-align: center;">
                            {{ getTime(record.schedule_date, "{y}-{m}-{d}") }}
                        </div>
                    </div>
                    <div class="inline_block" style="margin-left: 10px;">
                        透析次数：
                        <div class="under_line" style="width: 80px;text-align: center;">
                            {{ record.Count + record.patient.user_sys_before_count }}
                        </div>
                    </div>
                </div>
                <div style="border:1px solid #000;margin-top:5px;padding:0 10px;">
                    <div class="row">
                        <div class="inline_block">
                            T(°C):
                            <div class="under_line" style="width: 70px;text-align: center;">
                                {{ record.assessment_before_dislysis.temperature ? record.assessment_before_dislysis.temperature : "/" }}
                            </div>
                        </div>
                        <div class="inline_block">
                            P(次/分):
                            <div class="under_line" style="width: 70px;text-align: center;">
                                {{ record.assessment_before_dislysis.pulse_frequency ? record.assessment_before_dislysis.pulse_frequency : "/" }}
                            </div>
                        </div>
                        <div class="inline_block" style="margin-left: 10px;">
                            R(次/分):
                            <div class="under_line" style="width: 70px;text-align: center;">
                                {{ record.assessment_before_dislysis.breathing_rate ? record.assessment_before_dislysis.breathing_rate : "/" }}
                            </div>
                        </div>
                        <div class="inline_block" style="margin-left: 10px;">
                            BP(mmHg):
                            <div class="under_line" style="width: 70px;text-align: center;">
                                {{ record.assessment_before_dislysis.systolic_blood_pressure ? record.assessment_before_dislysis.systolic_blood_pressure : "" }}/
                                {{ record.assessment_before_dislysis.diastolic_blood_pressure ? record.assessment_before_dislysis.diastolic_blood_pressure : "" }}
                            </div>
                        </div>
                        <div class="inline_block" style="margin-left: 10px;">
                            透析机号:
                            <div class="under_line" style="width: 90px;text-align: center;">
                                {{ 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 }}
                            </div>
                        </div>
                        <div class="inline_block" style="margin-left: 10px;">
                            透析时长：
                            <div class="under_line" style="width: 40px;text-align: center;">
                                {{ record.prescription.dialysis_duration_hour ? record.prescription.dialysis_duration_hour : "0" }}
                            </div>h
                            <div class="under_line" style="width: 40px;text-align: center;">
                                {{ record.prescription.dialysis_duration_minute ? record.prescription.dialysis_duration_minute : "0" }}
                            </div>min
                        </div>
                    </div>
                    <div class="row">
                        <div class="inline_block">
                            透前体重(Kg):
                            <div class="under_line" style="width: 70px;text-align: center;">
                                {{ record.assessment_before_dislysis.weight_before ? record.assessment_before_dislysis.weight_before : "/" }}
                            </div>
                        </div>
                        <div class="inline_block">
                            干体重(Kg):
                            <div class="under_line" style="width: 70px;text-align: center;">
                                {{ record.assessment_before_dislysis.dry_weight ? record.assessment_before_dislysis.dry_weight : "/" }}
                            </div>
                        </div>
                        <div class="inline_block" style="margin-left: 10px;">
                            目标脱水量(ml):
                            <div class="under_line" style="width: 70px;text-align: center;">
                                {{ record.prescription.target_ultrafiltration ? record.prescription.target_ultrafiltration : '/' }}
                            </div>
                        </div>
                        <div class="inline_block" style="margin-left: 10px;">
                            透析方式:
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="!record.prescription.mode_id">
                            /
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 1">
                            HD
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 2">
                            HDF
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 3">
                            HD+HP
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 4">
                            HP
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 5">
                            HF
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 6">
                            SCUF
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 7">
                            IUF
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 8">
                            HFHD
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 9">
                            HFHD+HP
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 10">
                            PHF
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 11">
                            HFR
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 12">
                            HDF+HP
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 13">
                            CRRT
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 14">
                            腹水回输
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 15">
                            HD前置换
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 16">
                            HD后置换
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 17">
                            HDF前置换
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 18">
                            HDF后置换
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 19">
                            IUF+HD
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 20">
                            UF
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 21">
                            HD+
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 22">
                            血浆胆红素吸附+HDF
                            </div>
                            <div class="under_line" style="width: 150px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 23">
                            血浆胆红素吸附
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 24">
                            I-HDF
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 25">
                            HD高通
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 26">
                            CVVH
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 27">
                            CVVHD
                            </div>
                            <div class="under_line" style="width: 70px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 28">
                            CVVHDF
                            </div>
                           <div class="under_line" style="width: 150px;text-align: center;font-weight:600;" v-if="record.prescription.mode_id == 30">
                            血浆胆红素吸附+HDF
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="inline_block">
                            透析液(mmol/L):
                            <div class="under_line" style="width: 400px;text-align: center;">
                                K：{{ record.prescription.kalium ? record.prescription.kalium : "/" }}&nbsp;&nbsp;
                                Ca：{{ record.prescription.calcium ? record.prescription.calcium : "/" }}&nbsp;&nbsp;
                                Na：{{ record.prescription.sodium ? record.prescription.sodium : "/" }}&nbsp;&nbsp;
                                HCO3：{{ record.prescription.bicarbonate ? record.prescription.bicarbonate : "/" }}&nbsp;&nbsp;
                                糖：{{ record.prescription.amylaceum ? record.prescription.amylaceum : "/" }}&nbsp;&nbsp;
                            </div>
                        </div>
                        <div class="inline_block">
                            透析器:
                            <div class="under_line" style="width: 200px;text-align: center;">
                                {{ record.prescription.dialyzer_perfusion_apparatus ? record.prescription.dialyzer_perfusion_apparatus : "/" }}
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="inline_block">
                            抗凝剂:
                            <div class="under_line" style="width: 400px;text-align: center;">
                                <span v-if="record.prescription.anticoagulant == 0">&nbsp;/</span>
                                <span v-if="record.prescription.anticoagulant == 1">&nbsp;无肝素</span>
                                <span v-if="record.prescription.anticoagulant == 2">&nbsp;普通肝素</span>
                                <span v-if="record.prescription.anticoagulant == 3">&nbsp;低分子肝素</span>
                                <span v-if="record.prescription.anticoagulant == 4">&nbsp;阿加曲班</span>
                                <span v-if="record.prescription.anticoagulant == 5">&nbsp;枸橼酸钠</span>
                                <span v-if="record.prescription.anticoagulant == 6">&nbsp;低分子肝素钙</span>
                                <span v-if="record.prescription.anticoagulant == 7">&nbsp;低分子肝素钠</span>
                            </div>
                        </div>
                        <div class="inline_block">
                            首剂(UI):
                            <div class="under_line" style="width: 100px;text-align: center;">
                                {{ record.prescription.anticoagulant_shouji ? record.prescription.anticoagulant_shouji : "/" }}
                            </div>
                        </div>
                        <div class="inline_block">
                            追加(UI):
                            <div class="under_line" style="width: 100px;text-align: center;">
                                {{ record.prescription.anticoagulant_weichi ? record.prescription.anticoagulant_weichi : "/" }}
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="inline_block">
                            血管通路:
                            <div class="under_line" style="width: 200px;text-align: center;">
                                {{ QueryPartById(record.assessment_before_dislysis && record.assessment_before_dislysis.blood_access_part_opera_id ? record.assessment_before_dislysis.blood_access_part_opera_id : 0)}}
                            </div>
                        </div>
                        <div class="inline_block">
                            置换方式:
                            <div class="under_line" style="width: 100px;text-align: center;">
                                <span v-if="record.prescription.displace_liqui_part == ''">/</span>
                                <span v-if="record.prescription.displace_liqui_part == 1">前置换</span>
                                <span v-if="record.prescription.displace_liqui_part == 2">后置换</span>
                            </div>
                        </div>
                        <div class="inline_block">
                            置换液总量(L):
                            <div class="under_line" style="width: 100px;text-align: center;">
                                {{ record.prescription.displace_liqui_value ? record.prescription.displace_liqui_value : "/" }}
                            </div>
                        </div>
                        <div class="inline_block">
                            血流速(ml/min):
                            <div class="under_line" style="width: 100px;text-align: center;">
                                {{ record.prescription.blood_flow_volume ? record.prescription.blood_flow_volume : "/" }}
                            </div>
                        </div>
                    </div>
                    <div class="row" style="line-height: 30px;">
                        <div class="inline_block" style="width:100%;display:flex;">
                            透前病情:
                            <div class="under_line" style="border:1px solid #000;width:100%;flex:1;text-align:left;white-space: initial;">
                                {{ record.assessment_before_dislysis.symptom_before_dialysis ? record.assessment_before_dislysis.symptom_before_dialysis : '/' }}
                            </div>
                        </div>
                    </div>
                    <div class="row" style="line-height: 30px;">
                        <div class="inline_block" style="width:100%;display:flex;">
                            诊断:
                            <div class="under_line" style="border:1px solid #000;width:100%;flex:1;text-align:left;white-space: initial;">
                                {{ record.patient.diagnose ? record.patient.diagnose : '/' }}
                            </div>
                        </div>
                    </div>
                </div>
                <div style="text-align:center;letter-spacing:10px;line-height:40px;font-size:20px;">治疗记录</div>
                <table class="print-table" border="1" style="line-height:30px;">
                    <tbody>
                    <tr>
                        <td width="60">时间</td>
                        <td width="80" style="height:20px;line-height:20px">血压<br />mmHg</td>
                        <td width="60" style="height:20px;line-height:20px">脉搏<br />(次/分)</td>
                        <td width="60" style="height:20px;line-height:20px">KTV</td>
                        <td width="60" style="height:20px;line-height:20px">血流量<br />(ml/min)</td>
                        <td width="60" style="height:20px;line-height:20px">静脉压<br />mmHg</td>
                        <td width="60" style="height:20px;line-height:20px">动脉压<br />mmHg</td>
                        <td width="60" style="height:20px;line-height:20px">跨膜压<br />mmHg</td>
                        <td width="60" style="height:20px;line-height:20px">温度<br />°C</td>
                        <td width="60" style="height:20px;line-height:20px">超滤率<br />ml/h</td>
                        <td width="60" style="height:20px;line-height:20px">超滤量<br />ml</td>
<!--                        <td width="60" style="height:20px;line-height:20px" v-if="record.prescription.mode_id == 2">置换率<br /><br />ml/h</td>-->
<!--                        <td width="60" style="height:20px;line-height:20px" v-if="record.prescription.mode_id == 2">置换量<br /><br />ml</td>-->
                        <td width="60" style="height:20px;line-height:20px">血容量<br />L</td>
                        <td width="">病情变化及处理</td>
                    </tr>

                    <tr v-for="monitor in record.monitor_records" :key="monitor.id">
                        <td style="height:32px;line-height:32px;">&nbsp;{{ getTime(monitor.operate_time, "{h}:{i}") }}</td>
                        <td>
                            <span v-if="monitor.systolic_blood_pressure || monitor.diastolic_blood_pressure">
                                &nbsp;{{ monitor.systolic_blood_pressure ? monitor.systolic_blood_pressure : "" }}/
                                {{ monitor.diastolic_blood_pressure ? monitor.diastolic_blood_pressure : "" }}
                            </span>
                        </td>
                        <td>&nbsp;<span v-if="monitor.operate_time">{{ monitor.pulse_frequency ? monitor.pulse_frequency : "/" }}</span></td>
                        <td>&nbsp;<span v-if="monitor.operate_time">{{ monitor.ktv ? monitor.ktv : "/" }}</span></td>
                        <td>&nbsp;<span v-if="monitor.operate_time">{{ monitor.blood_flow_volume ? monitor.blood_flow_volume : "/" }}</span></td>
                        <td>&nbsp;<span v-if="monitor.operate_time">{{ monitor.venous_pressure ? monitor.venous_pressure : "/" }}</span></td>
                        <td>&nbsp;<span v-if="monitor.operate_time">{{ monitor.arterial_pressure ? monitor.arterial_pressure : "/" }}</span></td>

                        <td>&nbsp;<span v-if="monitor.operate_time">{{ monitor.transmembrane_pressure ? monitor.transmembrane_pressure : "/" }}</span></td>
                        <td>&nbsp;<span v-if="monitor.operate_time">{{monitor.dialysate_temperature ? monitor.dialysate_temperature : '/'}}</span></td>
                        <td>&nbsp;<span v-if="monitor.operate_time">{{ monitor.ultrafiltration_rate ? monitor.ultrafiltration_rate : '/'}}</span></td>
                        <td>&nbsp;<span v-if="monitor.operate_time">{{ monitor.ultrafiltration_volume ? monitor.ultrafiltration_volume : "/" }}</span></td>
<!--                        <td v-if="record.prescription.mode_id == 2">&nbsp;<span v-if="monitor.operate_time">{{ monitor.replacement_rate ? monitor.replacement_rate : '/'}}</span></td>-->
<!--                        <td v-if="record.prescription.mode_id == 2">&nbsp;<span v-if="monitor.operate_time">{{ monitor.displacement_quantity ? monitor.displacement_quantity : "/" }}</span></td>-->
                        <td>&nbsp;<span v-if="monitor.operate_time">{{ monitor.accumulated_blood_volume ? monitor.accumulated_blood_volume : "/" }}</span></td>
                        <td style="text-align:left;padding-left:10px;">
                            <div style="line-height:20px;text-align: left;display: inline-block;">
                                &nbsp;{{ monitor.symptom }}{{ monitor.dispose }}{{ monitor.result }}
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <div class="row" style="display: flex;justify-content: space-around;">
                    <div class="inline_block" style="display: flex;align-items: flex-end;">
                        预冲者：
                        <div class="under_line" style="width: 100px;text-align: center;">
                            <span style="display: inline-block;height: 36px;line-height: 36px;" v-if="setAdminUserES(record.dialysis_order, 'washpipe_nurse') == ''">{{getAdminUser(record.dialysis_order, 'washpipe_nurse')}}</span>
                            <span v-else>
                                <img class="es-img" style="height:30px;" :src="setAdminUserES(record.dialysis_order, 'washpipe_nurse')" />
                            </span>
                        </div>
                    </div>
                    <div class="inline_block" style="display: flex;align-items: flex-end;">
                        穿刺者：
                        <div class="under_line" style="width: 100px;text-align: center;">
                            <span style="display: inline-block;height: 36px;line-height: 36px;" v-if="setAdminUserES(record.dialysis_order, 'puncture_nurse') == ''">{{getAdminUser(record.dialysis_order, 'puncture_nurse')}}</span>
                            <span v-else>
                                <img class="es-img" style="height:30px;" :src="setAdminUserES(record.dialysis_order, 'puncture_nurse')" />
                            </span>
                        </div>
                    </div>
                    <div class="inline_block" style="margin-left: 10px;display: flex;align-items: flex-end;">
                        上机者：
                        <div class="under_line" style="width: 100px;text-align: center;">
                            <span style="display: inline-block;height: 36px;line-height: 36px;" v-if="setAdminUserES(record.dialysis_order, 'start_nurse') == ''">{{getAdminUser(record.dialysis_order, 'start_nurse')}}</span>
                            <span v-else>
                                <img class="es-img" style="height:30px;" :src="setAdminUserES(record.dialysis_order, 'start_nurse')" />
                            </span>
                        </div>
                    </div>
                    <div class="inline_block" style="margin-left: 10px;display: flex;align-items: flex-end;">
                        下机者：
                        <div class="under_line" style="width: 100px;text-align: center;">
                            <span style="display: inline-block;height: 36px;line-height: 36px;" v-if="setAdminUserES(record.dialysis_order, 'finish_nurse') == ''">{{getAdminUser(record.dialysis_order, 'finish_nurse')}}</span>
                            <span v-else>
                                <img class="es-img" style="height:30px;" :src="setAdminUserES(record.dialysis_order, 'finish_nurse')" />
                            </span>
                        </div>
                    </div>
                </div>
                <table class="print-table" border="1" style="line-height:30px;">
                    <tbody>
                    <tr style="height:32px;">
                        <td style="font-size: 16px" width="10%">时间</td>
                        <td style="font-size: 16px" colspan="2" width="45%">临时医嘱单</td>
                        <td style="font-size: 16px" width="10%">医生签名</td>
                        <td style="font-size: 16px" width="10%">执行护士</td>
                        <td style="font-size: 16px" width="10%">执行时间</td>
                    </tr>
                    <!-- <template v-for="group in doctor_advices" > -->

                    <tr v-for="(advice, advice_index) in record.his_advices" :key="advice_index">
                        <td height="32px;padding:1px 1px">
                            <span v-if="advice.start_time">
                                {{ getTime(advice.start_time, "{h}:{i}") }}
                            </span>
                        <!-- <span v-else>&nbsp;<br/>&nbsp;</span> -->
                        </td>
                        <td height="32px" colspan="2" class="advice-name" style="padding-left:7px;">
                            <span style="padding-left:5px;display:inline-block;">
                                <!-- <span v-if="item.children.length > 0"> -->
                                    <span v-if="advice.parent_id > 0">---></span>
                                    <span>{{ advice.advice_name }}</span>
                                    <span v-if="advice && advice.advice_desc">({{ advice.advice_desc }}{{ advice.drug_spec_unit }})</span>
                                    <span v-if="advice.prescribing_number"> &nbsp;&nbsp; {{ advice.prescribing_number }}{{ advice.prescribing_number_unit }}</span>
                                    <span v-if="advice.single_dose != 0">{{ advice.single_dose }}{{ advice.single_dose_unit }}</span>
                                    <span v-if="advice.parent_id == 0">{{ advice.delivery_way }}</span>
                                    <span v-if="advice.parent_id == 0">{{ advice.execution_frequency }}</span>
                                    <span v-if="advice.parent_id == 0 && advice.remark.length > 0">({{ advice.remark }})</span>
                                <!-- </span> -->
                            </span>
                        </td>

                        <td height="32px">
                            <span v-if="setAdminUserES(advice, 'advice_doctor') == ''">
                                {{getAdminUser(advice, 'advice_doctor')}}
                            </span>
                            <span v-else style="display:flex;align-items:center;justify-content:space-around;height:36px;">
                                <img style="height:30px;" :src="setAdminUserES(advice, 'advice_doctor')" alt srcset />
                            </span>
                        </td>
                        <td height="32px">
                            <span v-if="setAdminUserES(advice, 'execution_staff') == ''">
                                {{getAdminUser(advice, 'execution_staff')}}
                            </span>
                            <span v-else>
                                <img style="height:30px;" :src="setAdminUserES(advice, 'execution_staff')" alt srcset />
                            </span>
                        </td>
                        <td height="32px">
                            <span v-if="advice.execution_time">{{ getTime(advice.execution_time, "{h}:{i}") }}</span>
                        </td>
                    </tr>
                    <tr v-for="(advice, advice_index) in record.his_project" :key="advice_index">
                        <td height="32px;padding:1px 1px">
                            <span v-if="advice.start_time">
                                {{ getTime(advice.start_time, "{h}:{i}") }}
                            </span>
                        </td>
                        <td height="32px" colspan="2" class="advice-name" style="padding-left:7px;">
                            <span style="padding-left:5px;display:inline-block;">
                              <span>{{ advice && advice.project ? advice.project.project_name : '' }}</span>
                            </span>
                        </td>

                        <td height="32px">
                            <span v-if="setAdminUserES(advice, 'doctor') == ''">
                                {{getAdminUser(advice, 'doctor')}}
                            </span>
                            <span v-else style="display:flex;align-items:center;justify-content:space-around;height:36px;">
                                <img style="height:30px;" :src="setAdminUserES(advice, 'doctor')" alt srcset />
                            </span>
                        </td>
                        <td height="32px">
                            <span v-if="setAdminUserES(advice, 'execution_staff') == ''">
                                {{getAdminUser(advice, 'execution_staff')}}
                            </span>
                            <span v-else>
                                <img style="height:30px;" :src="setAdminUserES(advice, 'execution_staff')" alt srcset />
                            </span>
                        </td>
                        <td height="32px">
                            <span v-if="advice.execution_time">{{ getTime(advice.execution_time, "{h}:{i}") }}</span>
                        </td>
                    </tr>
                    <!-- </template> -->
                    </tbody>
                </table>
                <div style="border:1px solid #000;margin-top:5px;padding:0 10px;">
                    <div class="row">
                        <div class="inline_block">
                            透后体重(Kg):
                            <div class="under_line" style="width: 70px;text-align: center;">
                                {{ record.assessment_after_dislysis.weight_after ? record.assessment_after_dislysis.weight_after : "/" }}
                            </div>
                        </div>
                        <div class="inline_block">
                            实际脱水量(ml):
                            <div class="under_line" style="width: 70px;text-align: center;">
                                {{ record.assessment_after_dislysis.actual_ultrafiltration ? record.assessment_after_dislysis.actual_ultrafiltration : "/" }}
                            </div>
                        </div>
                        <div class="inline_block" style="margin-left: 10px;">
                            实际透析时长(h):
                            <div class="under_line" style="width: 50px;text-align: center;">
                                {{ record.assessment_after_dislysis.actual_treatment_hour ? record.assessment_after_dislysis.actual_treatment_hour : "0" }}
                            </div>h
                            <div class="under_line" style="width: 50px;text-align: center;">
                                {{ 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: 10px;">
                            BP(mmHg):
                            <div class="under_line" style="width: 70px;text-align: center;">
                                {{ record.assessment_after_dislysis.systolic_blood_pressure ? record.assessment_after_dislysis.systolic_blood_pressure : "" }}/
                                {{ record.assessment_after_dislysis.diastolic_blood_pressure ? record.assessment_after_dislysis.diastolic_blood_pressure : "" }}
                            </div>
                        </div>
                        <div class="inline_block" style="margin-left: 10px;">
                            P(次/分):
                            <div class="under_line" style="width: 70px;text-align: center;">
                                {{ record.assessment_after_dislysis.pulse_frequency ? record.assessment_after_dislysis.pulse_frequency : "/" }}
                            </div>
                        </div>
                    </div>
                    <div class="row" style="line-height: 30px;">
                        <div class="inline_block" style="width:100%;display:flex;">
                            小结：
                            <div class="under_line" style="border:1px solid #000;width:100%;flex:1;text-align:left;white-space: initial;">
                                {{  record.summer ? record.summer.dialysis_summary : "/" }}
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row" style="border-bottom:1px solid #000;display:flex;margin-top:50px;">
                    <div class="inline_block" style="width:33%">
                        医生签名：
                        <div class="under_line" style="width: 70px;text-align: center;">
                            <span style="display: inline-block;height: 36px;line-height: 36px;" v-if="setAdminUserES(record.prescription, 'creater') == ''">{{getAdminUser(record.prescription, 'creater')}}</span>
                            <img class="es-img" :src="setAdminUserES(record.prescription, 'creater')" alt="" srcset="" v-else style="height: 30px;">
                        </div>
                    </div>
                    <div class="inline_block" style="width:33%">
                        责任护士：
                        <div class="under_line" style="width: 70px;text-align: center;">
                            <span style="display: inline-block;height: 36px;line-height: 36px;" v-if="setAdminUserES(record.dialysis_order, 'start_nurse') == ''">{{getAdminUser(record.dialysis_order, 'start_nurse')}}</span>
                            <span v-else>
                                <img class="es-img" style="height:30px;" :src="setAdminUserES(record.dialysis_order, 'start_nurse')" />
                            </span>
                        </div>
                    </div>
                    <div class="inline_block" style="margin-left: 10px;width:33%">
                        查对护士：
                        <div class="under_line" style="width: 80px;text-align: center" v-if="record.dialysis_order.id == 0">
                            <span style="display: inline-block;height: 36px;line-height: 36px;" v-if="setAdminUserES(record.check, record.check == null ? 0 : 'creater') == ''">
                            {{ getAdminUser(record.check, "creater") }}
                            </span>
                            <img style="height:30px;" :src="setAdminUserES(record.check, record.check == null ? 0 : 'creater')" alt srcset v-else />
                        </div>
                        <div class="under_line" style="width: 80px;text-align: center" v-if="record.dialysis_order != null && record.check != null && record.dialysis_order.start_nurse == record.check.modifier">
                            <span style="display: inline-block;height: 36px;line-height: 36px;" v-if="setAdminUserES(record.check, record.check == null ? 0 : 'creater') == ''">
                            {{ getAdminUser(record.check, "creater") }}
                            </span>
                            <img style="height:30px;" :src="setAdminUserES(record.check, record.check == null ? 0 : 'creater')" alt srcset v-else />
                        </div>
                        <div class="under_line" style="width: 80px;text-align: center" v-if="record.dialysis_order != null && record.check != null && record.dialysis_order.start_nurse == record.check.creater">
                            <span style="display: inline-block;height: 36px;line-height: 36px;" v-if="setAdminUserES(record.check, record.check == null ? 0 : 'modifier') == ''">
                            {{ getAdminUser(record.check, record.check == null ? 0 : 'modifier') }}
                            </span>
                            <img style="height:30px;" :src="setAdminUserES(record.check, record.check == null ? 0 : 'modifier')" alt srcset v-else />
                        </div>
                        <div class="under_line" style="width: 80px;text-align: center" v-if="record.dialysis_order != null && record.check != null && record.dialysis_order.start_nurse != record.check.creater && record.dialysis_order.start_nurse != record.check.modifier">
                            <span style="display: inline-block;height: 36px;line-height: 36px;" v-if="setAdminUserES(record.check, record.check == null ? 0 : 'creater') == ''">
                            {{ getAdminUser(record.check, "creater") }}
                            </span>
                            <img style="height:30px;" :src="setAdminUserES(record.check, record.check == null ? 0 : 'creater')" alt srcset v-else />
                        </div>
                    </div>
                </div>
            </div>
          </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: [],
      doctor_advices: [],
      advice_groups: [],
      advice_groups_2: [],
      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.org_template_info = resp.data.templateInfo

          this.records = this.records.concat(resp.data.schedules)
          console.log("记录23323322332",this.records)


          for (const recordIndex in this.records) {
            var dlegh = 0
            if (
              this.records[recordIndex].monitor_records &&
              this.records[recordIndex].monitor_records.length < 6
            ) {
              dlegh = 6 - this.records[recordIndex].monitor_records.length
            } else {
              dlegh = 0
            }
            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([])
              }
            }

            this.records[recordIndex].isShowZero = false
            if (this.records[recordIndex].patient.user_org_id == 9535) {
              this.records[recordIndex].isShowZero = true
            }

            let his_project = []
            this.records[recordIndex].his_project.map(item => {
              if(item.type == 2){
                his_project.push(item)
              }
            })
            this.records[recordIndex].his_project = his_project

            var delghThree = 0
            if (
              this.records[recordIndex].his_advices &&
              this.records[recordIndex].his_advices.length + this.records[recordIndex].his_project.length < 6
            ) {
              delghThree = 6 - (this.records[recordIndex].his_advices.length + this.records[recordIndex].his_project.length)
            } else {
              delghThree = 0
            }

            if (delghThree > 0) {
              if (
                typeof this.records[recordIndex].his_project === 'undefined' ||
                this.records[recordIndex].his_project == null
              ) {
                this.records[recordIndex].his_project = []
              }
              for (let index = 0; index < delghThree; index++) {
                this.records[recordIndex].his_project.push([])
              }
            }
            this.records[recordIndex].his_advices = this.records[recordIndex].his_advices.sort((a,b)=>{ return a.id-b.id})

            // var delghTwo = 0
            // if (
            //   this.records[recordIndex].advices &&
            //   this.records[recordIndex].advices.length < 14
            // ) {
            //   delghTwo = 14 - this.records[recordIndex].advices.length
            // } else {
            //   delghTwo = 0
            // }

            // if (delghTwo > 0) {
            //   if (
            //     typeof this.records[recordIndex].advices === 'undefined' ||
            //     this.records[recordIndex].advices == null
            //   ) {
            //     this.records[recordIndex].advices = []
            //   }
            //   for (let index = 0; index < delghTwo; index++) {
            //     this.records[recordIndex].advices.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
          console.log('adminUser', this.adminUser)
          var name = resp.data.name
          this.adminSign = name
          console.log('name是', name)
          console.log('记录', this.records)
          this.loading = false
        } else {
          this.loading = false
          this.$message.error(resp.msg)
        }
      })
      .catch(err => {
        this.$message.error(err)
      })
  },
  methods: {
    QueryPartById: function(val) {
      let vascular_access_part_name = '/'
      const vascular_access = getDataConfig('hemodialysis', 'vascular_access_desc')
      for (let i = 0; i < vascular_access.length; i++) {
        if (vascular_access[i].id == val) {
          vascular_access_part_name = vascular_access[i].name
        }
      }
      return vascular_access_part_name
    },
    printThisPage() {
      var ptime = Math.round(new Date().getTime() / 1000)
      this.print_time = uParseTime(ptime, '{y}-{m}-{d} {h}:{i}')

      const style =
        '@media print {.dialysis-print-order{width:960px;margin:0 auto}.dialysis-print-order .order-yy-name{margin:auto;text-align:center;font-size:20px;letter-spacing:5px}.dialysis-print-order .order-title{margin:auto;font-weight:600;text-align:center;font-size:22px;padding:10px 20px 20px 20px}.dialysis-print-order .table-box{width:100%;line-height:23px;font-size:14px}.dialysis-print-order .print-table{width:100%;text-align:center;border-collapse:collapse;line-height:25px;font-size:14px}.dialysis-print-order .print-table-no{width:100%;text-align:center;border-collapse:collapse;font-size:14px}.dialysis-print-order .under-line{border-bottom:1px solid #999;width:95%;text-align:center;margin-left:2px}.dialysis-print-order .title-box{text-align:center;font-size:16px;border:1px solid #666}.dialysis-print-order .radio-lebel-box{font-weight:400;cursor:pointer}.dialysis-print-order .radio-no{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;z-index:-1}.dialysis-print-order .radio-inner{white-space:nowrap;cursor:pointer;outline:0;display:inline-block;line-height:1;position:relative;vertical-align:middle}.dialysis-print-order .radio-fang{display:inline-block;position:relative;border:1px solid #000;box-sizing:border-box;width:14px;height:14px;background-color:#fff;z-index:1;transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46)}.dialysis-print-order .is-checked-radio::after{content:"√";font-size:15px}}.dialysis-print-order .print-table-no tr td { padding: 8px 5px; line-height: 25px; }.es-img{height: 20px; }.advice-name{text-align: left;}.advice-children{display:flex;} .dialysis-print-order .print-table tr td{padding: 0px 0px;} .print-template-two tr {line-height: 30px;}   .title-box-pro{border: 0 #fff;line-height: 40px;height: 40px;text-align: left;padding-left: 10px !important;}  .text-align-left{text-align: left !important;padding-left:10px !important;font-size: 14px !important;line-height: 25px;}'
      const style2 =
        '@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; } .dialysis-print-order .order-title{margin:auto;font-weight:600;text-align:center;font-size:22px;padding:10px}.option_panel .check_box_panel .check_box { display: inline-block; position: relative; border: 1px solid #000; box-sizing: border-box; width: 14px; height: 12px; background-color: #fff; } .print-table{border: none} .print-table tr{page-break-inside:avoid;} .print-table tr td{border: 1px solid #000;}.check_box_panel .did_checked::after { content: "√"; font-size: 15px; } .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_two {display: inline-block;border-bottom: 1px solid #999;text-align: left;white-space: nowrap;width: 50%;}.under_line {display: inline-block;border-bottom: 1px solid #999;text-align: center;white-space: nowrap; width: 50%;}.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: 3px 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: 6px 5px;line-height: 16px;}.print-table-no {width: 100%;text-align: center;border-collapse: collapse;font-size: 14px;}.es-img {height: 30px;}.advice-name {text-align: left !important;line-height: 16px !important;}.advice-children {display: flex;}}.margin-bottom-50{margin-bottom:50px;}.margin-bottom-300 {margin-bottom:450px;}.margin-bottom-600 {margin-bottom:600px;}.margin-bottom-900 {margin-bottom:900px;}.print-yema{ position: absolute;top: 920px;left: 50%;} .print-yema2{ position: absolute;top: 400px;left: 50%;}.print-yema3{position: absolute;top: 1230px;left: 50%;}.print-yema4{position: absolute;top: 1050px;left: 50%;}.check_box{width:15px !important;height:15px !important;}.did_checke::after {font-size: 8px;margin-left: 2px;margin-top: 12px !important;position: absolute;}.table-box1 {border: 1px solid #000;width: 100%;line-height: 30px;font-size: 14px;border-collapse: collapse;}.table-box1 tr {border-bottom: 1px solid #000;} .print-table{width:100%;text-align:center;border-collapse:collapse;line-height:25px;font-size:14px}';
      const style9 =
        '@media print {#dialysis-print-box-1{margin:0 auto;}.dialysis-print-order{width:920px;margin:0 10px;font-size:10px;}.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; } .dialysis-print-order .order-title{margin:auto;font-weight:600;text-align:center;font-size:22px;padding:10px}.option_panel .check_box_panel .check_box { display: inline-block; position: relative; border: 1px solid #000; box-sizing: border-box; width: 14px; height: 12px; background-color: #fff; } .check_box_panel .did_checked::after { content: "√"; font-size: 15px; } .print_page_main_content {background-color: white;width: 940px;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_two {display: inline-block;border-bottom: 1px solid #999;text-align: left;white-space: nowrap;width: 50%;}.under_line {display: inline-block;border-bottom: 1px solid #999;text-align: center;white-space: nowrap; width: 50%;}.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: 3px 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: 6px 5px;line-height: 16px;}.print-table-no {width: 100%;text-align: center;border-collapse: collapse;font-size: 14px;}.es-img {height: 30px;}.advice-name {text-align: left !important;line-height: 16px !important;}.advice-children {display: flex;}}.margin-bottom-50{margin-bottom:50px;}.margin-bottom-300 {margin-bottom:450px;}.margin-bottom-600 {margin-bottom:600px;}.margin-bottom-900 {margin-bottom:900px;}.print-yema{ position: absolute;top: 920px;left: 50%;} .print-yema2{ position: absolute;top: 400px;left: 50%;}.print-yema3{position: absolute;top: 1230px;left: 50%;}.print-yema4{position: absolute;top: 1050px;left: 50%;}.check_box{width:15px !important;height:15px !important;}.did_checke::after {font-size: 8px;margin-left: 2px;margin-top: 12px !important;position: absolute;}.table-box1 {border: 1px solid #000;width: 100%;line-height: 30px;font-size: 14px;border-collapse: collapse;} @page {margin-top:5px;}.table-box1 tr {border-bottom: 1px solid #000;}';
      printJS({
        printable: 'print_content',
        type: 'html',
        documentTitle: '  ',
        style: style2,
        scanStyles: false
      })
    },
    getNewAge(UUserCard) {
      if (UUserCard != null && UUserCard != '') {
        // 获取年龄
        var myDate = new Date()
        var month = myDate.getMonth() + 1
        var day = myDate.getDate()
        var age = myDate.getFullYear() - UUserCard.substring(6, 10) - 1
        if (UUserCard.substring(10, 12) < month || UUserCard.substring(10, 12) == month && UUserCard.substring(12, 14) <= day) {
          age++
        }
        return age
      }
    },
    getIsCheckDataConfig(pName, cName, targetName) {
      var arr = getDataConfig(pName, cName);
      for (let i = 0; i < arr.length; i++) {
        if (arr[i].name == targetName) {
          return arr[i].id;
        }
      }
    },
    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; } .dialysis-print-order .order-title{margin:auto;font-weight:600;text-align:center;font-size:22px;padding:10px}.option_panel .check_box_panel .check_box { display: inline-block; position: relative; border: 1px solid #000; box-sizing: border-box; width: 14px; height: 12px; 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 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: 16px;line-height: 20px;padding: 5px 0;}.inline_block { display: inline-block;}.under_line_two {display: inline-block;border-bottom: 1px solid #999;text-align: left;white-space: nowrap;width: 50%;}.under_line {display: inline-block;border-bottom: 1px solid #999;text-align: center;white-space: nowrap; width: 50%;}.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: 5px 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: 16px;padding: 5px 5px;line-height: 18px;}.print-table-no {width: 100%;text-align: center;border-collapse: collapse;font-size: 14px;}.es-img {height: 30px;}.advice-name {text-align: left !important;line-height: 16px !important;}.advice-children {display: flex;}}.margin-bottom-300 {margin-bottom:450px;}.margin-bottom-600 {margin-bottom:600px;}.margin-bottom-900 {margin-bottom:950px;}.print-yema{ position: absolute;top: 920px;left: 50%;} .print-yema2{ position: absolute;top: 400px;left: 50%;}.print-yema3{position: absolute;top: 1230px;left: 50%;}.print-yema4{position: absolute;top:1050px;left: 50%;}.print-yema5{position: absolute;top:1370px;left: 50%;}.check_box{width:15px !important;height:15px !important;}.did_checke::after {font-size: 8px;margin-left: 2px;margin-top: 12px !important;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 "";
      }
    },
    getFloat: function(x) {
      if (x != ".") {
        var f = Math.round(x * 100) / 100;
        var s = f.toString();
        var rs = s.indexOf(".");
        if (rs <= 0) {
          rs = s.length;
          s += ".";
        }
        while (s.length <= rs + 1) {
          s += "0";
        }
        return s;
      } else {
        return "0.0";
      }
    },
    getAdminUser(key, 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;
      }
    },
    getAge: function(val) {
      if (val.birthday == 0) {
        return "";
      }
      return jsGetAge(uParseTime(val.birthday, "{y}-{m}-{d}"), "-");
    },
    newAdviceGroupObject: function() {
      return Object.assign(
        {},
        {
          group_no: 0,
          advices: []
        }
      );
    },
    getNumber: function(record) {
      console.log(record);
    }
  }
};
</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: 40px;
  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;
  width: 50%;
}

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

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

.under_line_two {
  display: inline-block;
  border-bottom: 1px solid #999;
  text-align: left;
  white-space: nowrap;
  width: 50%;
}

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

.under_line_two::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: 6px 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: 16px;
}

.print-table-no {
  width: 100%;
  text-align: center;
  border-collapse: collapse;
  font-size: 14px;
}

.es-img {
  height: 30px;
}

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

.advice-children {
  display: flex;
}

.margin-bottom-300 {
  margin-bottom: 450px;
}

.margin-bottom-600 {
  margin-bottom: 600px;
}

.margin-bottom-900 {
  margin-bottom: 900px;
}

.print-yema {
  position: absolute;
  left: 50%;
}

.print-yema2 {
  position: absolute;
  left: 50%;
}

.print-yema3 {
  position: absolute;
  left: 50%;
}

.print-yema4 {
  position: absolute;
  left: 50%;
}

.print-yema5 {
  position: absolute;
  left: 50%;
}

.did_checke::after {
  content: "\221A";
  font-size: 8px;
  margin-left: 2px;
  margin-top: 2px;
  position: absolute;
}

.dialysis-print-order {
  width: 960px;
  margin: 0 auto;
}

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

.dialysis-print-order .order-title {
  margin: auto;
  font-weight: 600;
  text-align: center;
  font-size: 22px;
  padding: 10px 20px 20px 20px;
}

.dialysis-print-order .table-box {
  width: 100%;
  line-height: 23px;
  font-size: 14px;
}

.dialysis-print-order .print-table {
  width: 100%;
  text-align: center;
  border-collapse: collapse;
  line-height: 40px;
  font-size: 14px;
}

.dialysis-print-order .print-table-no {
  width: 100%;
  text-align: center;
  border-collapse: collapse;
  font-size: 14px;
}

.dialysis-print-order .under-line {
  border-bottom: 1px solid #999;
  width: 95%;
  text-align: center;
  margin-left: 2px;
}

.dialysis-print-order .title-box {
  text-align: center;
  font-size: 16px;
}

.dialysis-print-order .radio-lebel-box {
  font-weight: 400;
  cursor: pointer;
}

.dialysis-print-order .radio-no {
  opacity: 0;
  outline: none;
  position: absolute;
  margin: 0;
  width: 0;
  height: 0;
  z-index: -1;
}

.dialysis-print-order .radio-inner {
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  display: inline-block;
  line-height: 1;
  position: relative;
  vertical-align: middle;
}

.dialysis-print-order .radio-fang {
  display: inline-block;
  position: relative;
  border: 1px solid #000;
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  background-color: #fff;
  z-index: 1;
  transition: border-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46),
    background-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46);
}

.dialysis-print-order .is-checked-radio::after {
  content: "√";
  font-size: 15px;
}

.dialysis-print-order .print-table-no tr td {
  padding: 8px 5px;
  line-height: 25px;
}

.dialysis-print-order .print-table tr td {
  padding: 1px 1px;
  /*line-height: 25px;*/
}

.es-img {
  height: 25px;
}

.advice-name {
  text-align: left;
}

.advice-children {
  display: flex;
}

.title-box-pro {
  border: 0 #fff;
  line-height: 25px;
  height: 25px;
  text-align: left;
  padding-left: 10px !important;
}

.title-box-pro-tr {
  border: 0 #fff;
}

.text-align-left {
  text-align: left !important;
  padding-left: 10px !important;
  font-size: 14px !important;
  line-height: 25px;
}

.print-table-tr-new td {
  line-height: 20px !important;
}

.border-top-solid {
  border: solid 1px #000;
}

.print-template-two tr {
  line-height: 30px;
}
</style>
<style>
.dialysis-print-order {
  width: 960px;
  margin: 0 auto;
}

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

.dialysis-print-order .order-title {
  margin: auto;
  font-weight: 600;
  text-align: center;
  font-size: 22px;
  padding: 10px 20px 20px 20px;
}

.dialysis-print-order .table-box {
  width: 100%;
  line-height: 23px;
  font-size: 14px;
}

.dialysis-print-order .print-table {
  width: 100%;
  text-align: center;
  border-collapse: collapse;
  line-height: 40px;
  font-size: 14px;
}

.dialysis-print-order .print-table-no {
  width: 100%;
  text-align: center;
  border-collapse: collapse;
  font-size: 14px;
}

.dialysis-print-order .under-line {
  border-bottom: 1px solid #999;
  width: 95%;
  text-align: center;
  margin-left: 2px;
}

.dialysis-print-order .title-box {
  text-align: center;
  font-size: 14px;
}

.dialysis-print-order .radio-lebel-box {
  font-weight: 400;
  cursor: pointer;
}

.dialysis-print-order .radio-no {
  opacity: 0;
  outline: none;
  position: absolute;
  margin: 0;
  width: 0;
  height: 0;
  z-index: -1;
}

.dialysis-print-order .radio-inner {
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  display: inline-block;
  line-height: 1;
  position: relative;
  vertical-align: middle;
}

.dialysis-print-order .radio-fang {
  display: inline-block;
  position: relative;
  border: 1px solid #000;
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  background-color: #fff;
  z-index: 1;
  transition: border-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46),
    background-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46);
}

.dialysis-print-order .is-checked-radio::after {
  content: "√";
  font-size: 19px;
}

.dialysis-print-order .print-table-no tr td {
  padding: 8px 5px;
  line-height: 25px;
}

.dialysis-print-order .print-table tr td {
  padding: 1px 1px;
  /*line-height: 25px;*/
}

.es-img {
  height: 25px;
}

.advice-name {
  text-align: left;
}

.advice-children {
  display: flex;
}

.title-box-pro {
  border: 0 #fff;
  line-height: 25px;
  height: 25px;
  text-align: left;
  padding-left: 10px !important;
}

.title-box-pro-tr {
  border: 0 #fff;
}

.text-align-left {
  text-align: left !important;
  padding-left: 10px !important;
  font-size: 14px !important;
  line-height: 25px;
}

.print-table-tr-new td {
  line-height: 20px !important;
}

.border-top-solid {
  border: solid 1px #000;
}

.print-template-two tr {
  line-height: 30px;
}
</style>
