<template>
  <div v-if="flag === 1" style="flex:1">
    <div
      id="printButtonA5"
      :style="savePdf ? 'position: relative;width: 210mm;font-family:msyh;transform: scale(0.95);transform-origin: left top;' : ''"
    >
      <div
        ref="htmlContent"
        :style="savePdf ? 'max-width: 100%;margin: 0 auto;' : ''"
      >
        <div
          style="
          font-size: 32px;
          font-weight: 700;
          text-align: center;
          font-family:MicrosoftYaHeiBold;
        "
        >
          温州医科大学附属眼视光医院
        </div>
        <div
          style="
          font-size: 30px;
          font-weight: 700;
          text-align: center;
          margin-bottom: 10px;
          font-family:MicrosoftYaHeiBold;
        "
        >
          {{
            archiveCaseCRFItem.formName.includes("复诊")
              ? "术前复诊门诊病历"
              : "初诊门诊病历"
          }}
        </div>
        <div
          style="
          display: flex;
          justify-content: center;
          border-bottom: 2px solid #6f6f6f;
          padding-bottom: 12px;
          margin-bottom: 12px;
        "
        >
          <span
            style="padding-right: 30px"
          >姓名：{{ formListValue.patientName }}</span>
          <span
            style="padding-right: 30px"
          >性别：{{ formListValue.patientSex }}</span>
          <span
            style="padding-right: 30px"
          >年龄：{{ formListValue.patientAge }}岁</span>
          <span
            style="padding-right: 30px"
          >PID：{{ formListValue.patientId }}</span>
          <span>日期：{{ formListValue.createDate }}</span>
        </div>
      </div>
      <div
        id="printA5"
        style="
        flex: 1;
        font-size: 16px;
        text-align: justify;
        line-height: 22px;
      "
        :style="savePdf ? 'max-width: 100%;margin: 0 auto;' : ''"
      >

        <div style="text-align: justify;line-height: 22px;">
          <div style="margin-bottom: 2px; break-inside: avoid">
            <span
              v-if="archiveCaseCRFItem.formName.includes('复诊')"
              style="display: flex; align-items: center"
            >
              <div style="font-weight: 700">主诉及病史：</div>
              {{ formListValue.zsandBs }}
            </span>
            <span v-else style="display: flex; align-items: center">
              <span style="font-weight: 700;font-family:MicrosoftYaHeiBold;">主诉：</span>
              <span>{{ formListValue.jsEyetypeRadio }}视力逐渐减退{{
                formListValue.jsTimeInput ? formListValue.jsTimeInput : "-"
              }}年</span>
            </span>
          </div>
          <div
            v-if="!archiveCaseCRFItem.formName.includes('复诊')"
            style="margin-bottom: 2px; break-inside: avoid"
          >
            <span style="font-weight: 700;font-family:MicrosoftYaHeiBold;">现病史：</span>
            <span>
              近{{
                formListValue.jsTimeInput ? formListValue.jsTimeInput : "-"
              }}年无明显诱因下{{ formListValue.jsEyetypeRadio }}视力逐渐减退；
              <span v-if="formListValue.yjbsCheckbox.length > 0">
                <!-- 视觉症状不包含无 -->
                <span v-if="!formListValue.yjbsCheckbox.includes('无')">
                  伴
                  <span
                    v-for="(item, index) in formListValue.yjbsCheckbox"
                    :key="index"
                  >
                    {{ item }}
                    <span
                      v-show="index < formListValue.yjbsCheckbox.length - 1"
                    >、</span>
                  </span>
                  <template v-if="yjbsNoCheckbox.length > 0">
                    、<span
                      v-for="(item, index) in yjbsNoCheckbox"
                      :key="'noyjbs' + index"
                    >
                      无{{ item }}
                      <span
                        v-show="index < yjbsNoCheckbox.length - 1"
                      >、</span> </span>等不适；
                  </template>
                </span>
                <!-- 视觉症状包含无 -->
                <span v-if="formListValue.yjbsCheckbox.includes('无')">
                  <span
                    v-for="(item, index) in yjbsAllCheckbox"
                    :key="'yjbs' + index"
                  >
                    无{{ item }}
                    <span
                      v-show="index < yjbsAllCheckbox.length - 1"
                    >、</span> </span>等不适；
                </span>
              </span>
              <span>
                <span v-if="formListValue.yxyjRadio === '有'">
                  <span v-if="formListValue.yxyjOkCheck">
                    OK镜：
                    <span>已戴{{ formListValue.yxyjOkInput
                    }}{{ formListValue.yxyjOkUnit }}</span>

                    <span
                      v-show="
                        formListValue.yxyjOkInput && formListValue.yxyjOkPlRadio
                      "
                    >，</span>

                    <span>{{ formListValue.yxyjOkPlRadio }}</span>

                    <span
                      v-show="
                        formListValue.yxyjOkPlRadio &&
                          formListValue.yxyjOkTdTimeInput
                      "
                    >，</span>

                    <span
                      v-if="formListValue.yxyjOkTdTimeInput"
                    >脱镜时间：{{ formListValue.yxyjOkTdTimeInput
                    }}{{ formListValue.yxyjOkTdTimeUnit }}</span>；
                  </span>
                  <span v-if="formListValue.yxyjRgpCheck">
                    RGP：
                    <span>已戴{{ formListValue.yxyjRgpInput
                    }}{{ formListValue.yxyjRgpUnit }}</span>

                    <span
                      v-show="
                        formListValue.yxyjRgpInput && formListValue.yxyjRgpPlRadio
                      "
                    >，</span>

                    <span>{{ formListValue.yxyjRgpPlRadio }}</span>

                    <span
                      v-show="
                        formListValue.yxyjRgpPlRadio &&
                          formListValue.yxyjRgpTdTimeInput
                      "
                    >，</span>

                    <span
                      v-if="formListValue.yxyjRgpTdTimeInput"
                    >脱镜时间：{{ formListValue.yxyjRgpTdTimeInput
                    }}{{ formListValue.yxyjRgpTdTimeUnit }}</span>；
                  </span>
                  <span v-if="formListValue.yxyjRjCheck">
                    软镜：
                    <span>已戴{{ formListValue.yxyjRjInput
                    }}{{ formListValue.yxyjRjUnit }}</span>

                    <span
                      v-show="
                        formListValue.yxyjRjInput && formListValue.yxyjRjPlRadio
                      "
                    >，</span>

                    <span>{{ formListValue.yxyjRjPlRadio }}</span>

                    <span
                      v-show="
                        formListValue.yxyjRjPlRadio &&
                          formListValue.yxyjRjTdTimeInput
                      "
                    >，</span>

                    <span
                      v-if="formListValue.yxyjRjTdTimeInput"
                    >脱镜时间：{{ formListValue.yxyjRjTdTimeInput
                    }}{{ formListValue.yxyjRjTdTimeUnit }}</span>；
                  </span>
                </span>
              </span>
              <span>
                2年内情况：
                <span v-if="formListValue.twoYearwdqkRadio">
                  {{ formListValue.twoYearwdqkRadio }}
                  <span v-if="formListValue.twoYearwdqkRadio === '不稳定'">
                    ，每年增长{{
                      formListValue.everyYearDsInput
                        ? formListValue.everyYearDsInput
                        : " -"
                    }}度
                  </span>
                </span>
                <span v-else>-</span>
              </span>
            </span>
            <span v-show="formListValue.yqssCheckbox.length">
              ，现为
              <span
                v-for="(item, index) in formListValue.yqssCheckbox"
                :key="index"
              >
                {{ item }}
                <span
                  v-show="
                    index < formListValue.yqssCheckbox.length - 1 &&
                      item !== '体检'
                  "
                >、</span>
                <span v-if="item === '体检'">
                  ：<span
                    v-for="(iten, i) in formListValue.tijianCheckbox"
                    :key="i"
                  >
                    {{ iten }}
                    <span
                      v-show="i < formListValue.tijianCheckbox.length - 1"
                    >、</span>
                  </span>
                  <span
                    v-show="
                      formListValue.yqssCheckbox.includes('体检') &&
                        formListValue.yqssCheckbox.length > 1
                    "
                  >、</span>
                </span>
              </span>
              <span
                v-if="formListValue.yqssCheckbox.includes('其它')"
              >：{{ formListValue.ssqtInput }}</span>
              要求手术
            </span>
          </div>
          <div
            v-if="!archiveCaseCRFItem.formName.includes('复诊')"
            style="margin-bottom: 2px; break-inside: avoid"
          >
            <span style="font-weight: 700;font-family:MicrosoftYaHeiBold;">既往史/家族史：</span>
            <span>
              外伤/手术史：
              {{
                formListValue.wsOperaRadio === "有"
                  ? formListValue.wsOperaInput
                  : formListValue.wsOperaRadio
              }}
              ；
            </span>
            <span>
              药物过敏史：
              {{
                formListValue.ywgmsRadio === "有"
                  ? formListValue.ywgmsInput
                  : formListValue.ywgmsRadio
              }}
              ；
            </span>
            <span>
              瘢痕体质：
              {{
                formListValue.bhtzRadio === "有"
                  ? formListValue.bhtzInput
                  : formListValue.bhtzRadio
              }}
              ；
            </span>
            <span>
              其它全身病史：
              <span v-if="formListValue.qtbsRadio === '有'">
                <span
                  v-for="(item, index) in formListValue.qtbsCheck"
                  :key="index"
                >
                  <span v-show="item !== '其它'">{{ item }}</span>
                  <span
                    v-show="index < formListValue.qtbsCheck.length - 1"
                  >、</span>
                </span>
                <span v-if="formListValue.qtbsCheck.includes('其它')">
                  {{ formListValue.qtbsInput }}
                </span>
              </span>
              <span v-else>{{ formListValue.qtbsRadio }}</span>
              ；
            </span>
            <span>
              近期服药史：
              <span v-if="formListValue.fysRadio === '有'">
                <span
                  v-for="(item, index) in formListValue.fysCheck"
                  :key="index"
                >
                  <span v-show="item !== '其它'">{{ item }}</span>
                  <span
                    v-show="index < formListValue.fysCheck.length - 1"
                  >、</span>
                </span>
                <span v-if="formListValue.fysCheck.includes('其它')">
                  {{ formListValue.fysInput }}
                </span>
              </span>
              <span v-else>{{ formListValue.fysRadio }}</span>
              ；
            </span>
            <span>
              家族史：
              {{
                formListValue.jzsRadio === "有"
                  ? formListValue.jzsInput
                  : formListValue.jzsRadio
              }}
              ；
            </span>
            <span>
              其它屈光手术史：
              {{
                formListValue.qtqgssRadio === "有"
                  ? formListValue.qtqgssInput
                  : formListValue.qtqgssRadio
              }}
              ；
            </span>
            <span>
              眼病及眼科手术史：
              {{
                formListValue.ybykSssRadio === "有"
                  ? formListValue.ybykSssInput
                  : formListValue.ybykSssRadio
              }}
            </span>
          </div>
          <div style="margin-bottom: 2px; break-inside: avoid">
            <span style="font-weight: 700;font-family:MicrosoftYaHeiBold;">专科检查：</span>
            <span>
              <span>
                <b style="font-family:MicrosoftYaHeiBold;">裸眼视力：</b>
                <span
                  v-show="formListValue.slMingDate"
                >{{ formListValue.slMingDate }}：</span>
                右：
                {{
                  formListValue.slLyYuanMingOd
                    ? formListValue.slLyYuanMingOd
                    : "-"
                }}/{{
                  formListValue.slLyJinMingOd ? formListValue.slLyJinMingOd : "-"
                }}/{{
                  formListValue.slDjMingOd ? formListValue.slDjMingOd : "-"
                }}、 左：
                {{
                  formListValue.slLyYuanMingOs
                    ? formListValue.slLyYuanMingOs
                    : "-"
                }}/{{
                  formListValue.slLyJinMingOs ? formListValue.slLyJinMingOs : "-"
                }}/{{ formListValue.slDjMingOs ? formListValue.slDjMingOs : "-" }}
                （或/和）
                <b style="font-family:MicrosoftYaHeiBold;">矫正视力：</b>
                <span
                  v-show="formListValue.zjygXtDate"
                >{{ formListValue.zjygXtDate }}：</span>
                右：
                {{ formListValue.zjygXtOd4 ? formListValue.zjygXtOd4 : "-" }}、
                左：
                {{ formListValue.zjygXtOs4 ? formListValue.zjygXtOs4 : "-" }}；
              </span>
              <span>
                <b style="font-family:MicrosoftYaHeiBold;">眼压：</b>
                <span
                  v-show="formListValue.yyDate"
                >{{ formListValue.yyDate }}：</span>
                右：{{ formListValue.yyOd1 ? formListValue.yyOd1 : "-" }}/{{
                  formListValue.yyOd2 ? formListValue.yyOd2 : "-"
                }}mmHg、 左：{{
                  formListValue.yyOs1 ? formListValue.yyOs1 : "-"
                }}/{{
                  formListValue.yyOs2 ? formListValue.yyOs2 : "-"
                }}mmHg </span>；
              <span>
                <span style="margin-top: 10px"><b style="font-family:MicrosoftYaHeiBold;">裂隙灯检查：</b></span>
                <span
                  v-show="formListValue.lxdjcDate"
                >{{ formListValue.lxdjcDate }}：</span>
                右眼：
                <span
                  v-if="
                    formListValue.lxdjcYanjOd.length <= 0 &&
                      formListValue.lxdjcJiemOd.length <= 0 &&
                      formListValue.lxdjcJiaomOd.length <= 0 &&
                      formListValue.lxdjcQianfOd.length <= 0 &&
                      formListValue.lxdjcTonkOd.length <= 0 &&
                      formListValue.lxdjcJintOd.length <= 0
                  "
                >-</span>
                <span v-if="formListValue.lxdjcYanjOd.length > 0">
                  眼睑：
                  <span
                    v-for="(item, index) in formListValue.lxdjcYanjOd"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.lxdjcYanjOd.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.lxdjcJiemOd.length > 0 ||
                        formListValue.lxdjcJiaomOd.length > 0 ||
                        formListValue.lxdjcQianfOd.length > 0 ||
                        formListValue.lxdjcTonkOd.length > 0 ||
                        formListValue.lxdjcJintOd.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.lxdjcJiemOd.length > 0">
                  结膜:
                  <span
                    v-for="(item, index) in formListValue.lxdjcJiemOd"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.lxdjcJiemOd.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.lxdjcJiaomOd.length > 0 ||
                        formListValue.lxdjcQianfOd.length > 0 ||
                        formListValue.lxdjcTonkOd.length > 0 ||
                        formListValue.lxdjcJintOd.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.lxdjcJiaomOd.length > 0">
                  角膜：
                  <span
                    v-for="(item, index) in formListValue.lxdjcJiaomOd"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.lxdjcJiaomOd.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.lxdjcQianfOd.length > 0 ||
                        formListValue.lxdjcTonkOd.length > 0 ||
                        formListValue.lxdjcJintOd.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.lxdjcQianfOd.length > 0">
                  前房：
                  <span
                    v-for="(item, index) in formListValue.lxdjcQianfOd"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.lxdjcQianfOd.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.lxdjcTonkOd.length > 0 ||
                        formListValue.lxdjcJintOd.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.lxdjcTonkOd.length > 0">
                  瞳孔：
                  <span
                    v-for="(item, index) in formListValue.lxdjcTonkOd"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.lxdjcTonkOd.length-1 >index"> | </span>
                  </span>
                  <span v-show="formListValue.lxdjcJintOd.length > 0">、</span>
                </span>
                <span v-if="formListValue.lxdjcJintOd.length > 0">
                  晶体：
                  <span
                    v-for="(item, index) in formListValue.lxdjcJintOd"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.lxdjcJintOd.length-1 >index"> | </span>
                  </span>
                </span>
              </span>；
              <span>
                左眼：
                <span
                  v-if="
                    formListValue.lxdjcYanjOs.length <= 0 &&
                      formListValue.lxdjcJiemOs.length <= 0 &&
                      formListValue.lxdjcJiaomOs.length <= 0 &&
                      formListValue.lxdjcQianfOs.length <= 0 &&
                      formListValue.lxdjcTonkOs.length <= 0 &&
                      formListValue.lxdjcJintOs.length <= 0
                  "
                >-</span>
                <span v-if="formListValue.lxdjcYanjOs.length > 0">
                  眼睑：
                  <span
                    v-for="(item, index) in formListValue.lxdjcYanjOs"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.lxdjcYanjOs.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.lxdjcJiemOs.length > 0 ||
                        formListValue.lxdjcJiaomOs.length > 0 ||
                        formListValue.lxdjcQianfOs.length > 0 ||
                        formListValue.lxdjcTonkOs.length > 0 ||
                        formListValue.lxdjcJintOs.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.lxdjcJiemOs.length > 0">
                  结膜：
                  <span
                    v-for="(item, index) in formListValue.lxdjcJiemOs"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.lxdjcJiemOs.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.lxdjcJiaomOs.length > 0 ||
                        formListValue.lxdjcQianfOs.length > 0 ||
                        formListValue.lxdjcTonkOs.length > 0 ||
                        formListValue.lxdjcJintOs.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.lxdjcJiaomOs.length > 0">
                  角膜：
                  <span
                    v-for="(item, index) in formListValue.lxdjcJiaomOs"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.lxdjcJiaomOs.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.lxdjcQianfOs.length > 0 ||
                        formListValue.lxdjcTonkOs.length > 0 ||
                        formListValue.lxdjcJintOs.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.lxdjcQianfOs.length > 0">
                  前房：
                  <span
                    v-for="(item, index) in formListValue.lxdjcQianfOs"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.lxdjcQianfOs.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.lxdjcTonkOs.length > 0 ||
                        formListValue.lxdjcJintOs.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.lxdjcTonkOs.length > 0">
                  瞳孔：
                  <span
                    v-for="(item, index) in formListValue.lxdjcTonkOs"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.lxdjcTonkOs.length-1 >index"> | </span>
                  </span>
                  <span v-show="formListValue.lxdjcJintOs.length > 0">、</span>
                </span>
                <span v-if="formListValue.lxdjcJintOs.length > 0">
                  晶体：
                  <span
                    v-for="(item, index) in formListValue.lxdjcJintOs"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.lxdjcJintOs.length-1 >index"> | </span>
                  </span>
                </span>
              </span>
              <span>；</span>
              <span>
                <span style="margin-top: 10px"><b style="font-family:MicrosoftYaHeiBold;">散瞳眼底检查：</b></span>
                <span
                  v-show="formListValue.stydjcDate"
                >{{ formListValue.stydjcDate }}：</span>
                右眼：
                <span
                  v-if="
                    formListValue.stydjcShipOd.length <= 0 &&
                      formListValue.stydjcCdOd.length <= 0 &&
                      formListValue.stydjcHuangbOd.length <= 0 &&
                      formListValue.stydjcXuegOd.length <= 0 &&
                      formListValue.stydjcShiwmOd.length <= 0
                  "
                >-</span>
                <span v-if="formListValue.stydjcShipOd.length > 0">
                  视盘：
                  <span
                    v-for="(item, index) in formListValue.stydjcShipOd"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.stydjcShipOd.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.stydjcCdOd.length > 0 ||
                        formListValue.stydjcHuangbOd.length > 0 ||
                        formListValue.stydjcXuegOd.length > 0 ||
                        formListValue.stydjcShiwmOd.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.stydjcCdOd.length > 0">
                  C/D：
                  <span
                    v-for="(item, index) in formListValue.stydjcCdOd"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.stydjcCdOd.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.stydjcHuangbOd.length > 0 ||
                        formListValue.stydjcXuegOd.length > 0 ||
                        formListValue.stydjcShiwmOd.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.stydjcHuangbOd.length > 0">
                  黄斑：
                  <span
                    v-for="(item, index) in formListValue.stydjcHuangbOd"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.stydjcHuangbOd.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.stydjcXuegOd.length > 0 ||
                        formListValue.stydjcShiwmOd.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.stydjcXuegOd.length > 0">
                  血管：
                  <span
                    v-for="(item, index) in formListValue.stydjcXuegOd"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.stydjcXuegOd.length-1 >index"> | </span>
                  </span>
                  <span v-show="formListValue.stydjcShiwmOd.length > 0">、</span>
                </span>
                <span v-if="formListValue.stydjcShiwmOd.length > 0">
                  视网膜：
                  <span
                    v-for="(item, index) in formListValue.stydjcShiwmOd"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.stydjcShiwmOd.length-1 >index"> | </span>
                  </span>
                </span>
              </span>
              <span>；</span>
              <span>
                左眼：
                <span
                  v-if="
                    formListValue.stydjcShipOs.length <= 0 &&
                      formListValue.stydjcCdOs.length <= 0 &&
                      formListValue.stydjcHuangbOs.length <= 0 &&
                      formListValue.stydjcXuegOs.length <= 0 &&
                      formListValue.stydjcShiwmOs.length <= 0
                  "
                >-</span>
                <span v-if="formListValue.stydjcShipOs.length > 0">
                  视盘：
                  <span
                    v-for="(item, index) in formListValue.stydjcShipOs"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.stydjcShipOs.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.stydjcCdOs.length > 0 ||
                        formListValue.stydjcHuangbOs.length > 0 ||
                        formListValue.stydjcXuegOs.length > 0 ||
                        formListValue.stydjcShiwmOs.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.stydjcCdOs.length > 0">
                  C/D：
                  <span
                    v-for="(item, index) in formListValue.stydjcCdOs"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.stydjcCdOs.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="formListValue.stydjcHuangbOs.length > 0 ||
                      formListValue.stydjcXuegOs.length > 0 ||
                      formListValue.stydjcShiwmOs.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.stydjcHuangbOs.length > 0">
                  黄斑：
                  <span
                    v-for="(item, index) in formListValue.stydjcHuangbOs"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.stydjcHuangbOs.length-1 >index"> | </span>
                  </span>
                  <span
                    v-show="
                      formListValue.stydjcXuegOs.length > 0 ||
                        formListValue.stydjcShiwmOs.length > 0"
                  >、</span>
                </span>
                <span v-if="formListValue.stydjcXuegOs.length > 0">
                  血管：
                  <span
                    v-for="(item, index) in formListValue.stydjcXuegOs"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.stydjcXuegOs.length-1 >index"> | </span>
                  </span>
                  <span v-show="formListValue.stydjcShiwmOs.length > 0">、</span>
                </span>
                <span v-if="formListValue.stydjcShiwmOs.length > 0">
                  视网膜：
                  <span
                    v-for="(item, index) in formListValue.stydjcShiwmOs"
                    :key="index"
                  >{{ item }}
                    <span v-if="formListValue.stydjcShiwmOs.length-1 >index"> | </span>
                  </span>
                </span>
              </span>
            </span>
          </div>
          <div style="margin-bottom: 2px; break-inside: avoid">
            <span style="font-weight: 700;font-family:MicrosoftYaHeiBold;">辅助检查：</span>
            <span>
              <span>
                <b style="font-family:MicrosoftYaHeiBold;">主觉验光小瞳：</b>
                <span
                  v-show="formListValue.zjygXtDate"
                >{{ formListValue.zjygXtDate }}：</span>
                右眼：
                {{ formListValue.zjygXtOd1 ? formListValue.zjygXtOd1 : "-" }}
                /
                {{ formListValue.zjygXtOd2 ? formListValue.zjygXtOd2 : "-" }}
                X
                {{ formListValue.zjygXtOd3 ? formListValue.zjygXtOd3 : "-" }}
                =
                {{ formListValue.zjygXtOd4 ? formListValue.zjygXtOd4 : "-" }}、
              </span>
              <span>
                左眼：
                {{ formListValue.zjygXtOs1 ? formListValue.zjygXtOs1 : "-" }}
                /
                {{ formListValue.zjygXtOs2 ? formListValue.zjygXtOs2 : "-" }}
                X
                {{ formListValue.zjygXtOs3 ? formListValue.zjygXtOs3 : "-" }}
                =
                {{ formListValue.zjygXtOs4 ? formListValue.zjygXtOs4 : "-" }}
              </span>
            </span>
          <!-- <span>
            <span>
              <b style="font-family:MicrosoftYaHeiBold;">主觉验光散瞳：</b>
              <span v-show="formListValue.zjygStDate">{{ formListValue.zjygStDate }}：</span>
              右眼：
              {{ formListValue.zjygStOd1 ? formListValue.zjygStOd1 : '-' }}
              /
              {{ formListValue.zjygStOd2 ? formListValue.zjygStOd2 : '-' }}
              X
              {{ formListValue.zjygStOd3 ? formListValue.zjygStOd3 : '-' }}
              =
              {{ formListValue.zjygStOd4 ? formListValue.zjygStOd4 : '-' }}、
            </span>
            <span>
              左眼：
              {{ formListValue.zjygStOs1 ? formListValue.zjygStOs1 : '-' }}
              /
              {{ formListValue.zjygStOs2 ? formListValue.zjygStOs2 : '-' }}
              X
              {{ formListValue.zjygStOs3 ? formListValue.zjygStOs3 : '-' }}
              =
              {{ formListValue.zjygStOs4 ? formListValue.zjygStOs4 : '-' }}
            </span>
          </span> -->
          </div>
          <div style="margin-bottom: 2px; break-inside: avoid">
            <span style="font-weight: 700;font-family:MicrosoftYaHeiBold;">初步诊断：</span>
            <span>{{ formListValue.zd ? formListValue.zd : "无" }}</span>
          </div>
          <div style="margin-bottom: 2px; break-inside: avoid">
            <span style="font-weight: 700;font-family:MicrosoftYaHeiBold;">处理意见：</span>
            <span>{{ formListValue.clyj ? formListValue.clyj : "-" }}</span>
          </div>
        </div>
        <!-- v-if="base64Flag" -->
        <div
          style="
          display: flex;
          align-items: center;
          justify-content: flex-end;
          break-inside: avoid;
          margin-right: 35px;
        "
        >
          医生签字：
          <span>
            <span v-if="!formListValue.createSign" style="padding-left:12px;">{{ formListValue.createName ? formListValue.createName : '-' }}</span>
            <img
              v-else
              :src="formListValue.createSign"
              alt=""
              width="120px"
              style="display: block;break-inside: avoid"
            >
          </span>
          <!-- <img
            :src="savePdf ? '' : formListValue.createSign"
            alt=""
            width="120px"
            style="display: block;break-inside: avoid"
          > -->
        </div>
      </div>
    </div>
    <div v-if="formListValue.isConfirm===1" style="color:green;font-size:40px;text-align: center;margin-top: 60px;font-weight: 700;">已CA签字</div>
    <div v-if="formListValue.isConfirm!==1" style="color:red;font-size:40px;text-align: center;margin-top: 60px;font-weight: 700;">未CA签字</div>
  </div>

</template>

<script>
import htmlToPdfToBlob from '@/mixins/htmlToPdfToBlob'
const Base64 = require('js-base64').Base64
export default {
  mixins: [htmlToPdfToBlob],
  props: {
    archiveCaseCRFItem: {
      type: Object,
      default: () => {}
    },
    currentUrl: {
      type: String,
      default: ''
    },
    savePdf: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      formListValue: {},
      flag: 0,
      yjbsAllCheckbox: [
        '视疲劳',
        '眩光',
        '眼干',
        '眼酸',
        '眼胀',
        '眼痛',
        '飞蚊症',
        '眼痒',
        '流泪'
      ],
      yjbsNoCheckbox: [],
      recordId: '',
      formFlag: '',
      userData: {}
    }
  },
  computed: {
    dataRule() {
      return {}
    }
  },
  methods: {
    // CA启动逻辑判断
    init(id, formFlag) {
      this.recordId = id
      this.formFlag = formFlag
      // console.log('this.$parent', this.$parent.$parent.formListValue)
      const parentFormlistValue = this.$parent.$parent.formListValue
      if ((this.archiveCaseCRFItem.formName.includes('复诊') && parentFormlistValue.zsandBs && parentFormlistValue.zd && parentFormlistValue.clyj) ||
                !this.archiveCaseCRFItem.formName.includes('复诊') && (parentFormlistValue.jsEyetypeRadio || parentFormlistValue.jsTimeInput) && parentFormlistValue.zd && parentFormlistValue.clyj) {
        this.getSendCaStatus(id)
      }
    },
    // 是否开启了CA认证表单状态
    async getSendCaStatus(id) {
      const { data: res } = await this.$http.get('/quguang/caSign/getSendCaStatus', {
        params: {
          name: this.archiveCaseCRFItem.formName
        }
      })
      if (res.code === 0) {
        res.data === 1 ? this.getQgEmrRecordInfo(id, 'savePdf') : ''
      } else {
        this.$message.error(res.msg)
      }
    },
    // 获取屈光电子病历信息
    async getQgEmrRecordInfo(id, savePdf) {
      // savePdf ? this.loading = this.$loading({
      //   lock: true,
      //   text: '转存PDF中请稍等...',
      //   spinner: 'el-icon-loading',
      //   background: 'rgba(255, 255, 255, 0.7)'
      // }) : ''
      // this.base64Flag = false
      this.flag = 0
      const { data: res } = await this.$http.get('/quguang/qg/emr/getQgEmrRecordInfo', {
        params: {
          id: id
        }
      })
      if (res.code === 0) {
        Object.keys(res.data).forEach((item, index) => {
          // 如果不为空就赋值上去
          if (
            (res.data[item] &&
              res.data[item] !== 'false' &&
              res.data[item] !== 'true') ||
            typeof res.data[item] === 'number'
          ) {
            // 目前转为使用jsPDF不需要转换图片为base64了，如果使用html2pdf需要转，如果不转图片生成不出来
            // if (item === 'createSign') {
            //   // this.convertImageToBase64(res.data.createSign, 'createSign')
            // } else {
            //   this.formListValue[item] = res.data[item]
            // }
            this.formListValue[item] = res.data[item]
          }
          if (res.data[item] && typeof res.data[item] !== 'number') {
            res.data[item].includes('[') ||
            res.data[item] === 'false' ||
            res.data[item] === 'true'
              ? (this.formListValue[item] = JSON.parse(res.data[item]))
              : ''
            if (res.data[item].includes('&lt;0.3')) {
              const dataValue = JSON.parse(res.data[item])
              dataValue.splice(dataValue.indexOf('&lt;0.3'), 1, '<0.3')
              this.formListValue[item] = dataValue
            }
            if (item === 'yjbsCheckbox') {
              // 视觉症状取差集
              this.yjbsNoCheckbox = [...this.yjbsAllCheckbox].filter((x) =>
                [...this.formListValue.yjbsCheckbox].every((y) => y !== x)
              )
            }
          }
          if (Object.keys(res.data).length - 1 === index) {
            this.flag = 1
            console.log('savePdf', savePdf)
            if (savePdf) {
              this.formListValue.createSign = ''
              window.localStorage.getItem('qg-userData') ? this.userData = JSON.parse(window.localStorage.getItem('qg-userData')) : ''
              const caParams = {
                // 文件名称
                fileName: this.archiveCaseCRFItem.formName,
                // 表单标志位，1:屈光电子病历/屈光电子病历(复诊) 2:术后检查记录表，3:角膜交联病历/角膜交联病历(复诊)，4:角膜交联术后检查记录单,5:复诊病历,6:手术计划
                formFlag: 1,
                patientIdNumber: this.archiveCaseCRFItem.patientIdNumber,
                patientCentreId: this.userData.centreId,
                patientName: this.archiveCaseCRFItem.patientName,
                patientId: this.archiveCaseCRFItem.patientId,
                // 表单id
                formId: this.archiveCaseCRFItem.id,
                // 记录id
                recordId: this.recordId,
                signUser: {
                  // 签署位置集合
                  position: [
                    {
                      // 坐标签署X轴（数值为0-1之间的小数，以左下角为原点0,右角顶点为1） * 签署位置类型为:2必填
                      coX: '',
                      // 坐标签署Y轴（数值为0-1之间的小数，以左下角为原点0,右角顶点为1） * 签署位置类型为:2必填
                      coY: '',
                      // 关键字 签署位置类型为:1必填
                      keyword: '医生签字：',
                      // 关键字偏移（左右），单位像素 签署位置类型为:1必填
                      offsetX: '0.1',
                      // 关键字偏移（上下），单位像素 签署位置类型为:1必填
                      offsetY: '0',
                      // 签署位置类型为:2必填 * 坐标签署页码，格式“A-B"，A为起始页，B为结束页，如“1-5"表示从第1到第5页。“0-0"表示签所有页
                      pageNo: '',
                      // 签名图片和时间戳分开时必填 * 1：签字位置(默认); * 6: 签署时间
                      signatureType: '',
                      // 是否附加签名时间，签名时间显示于签字/印章图片的下方,内层外层需要同时填入才可生效 * 1：附加；0：不附加 (默认)
                      timestamp: '1',
                      // 签署位置类型（1：关键字；2：坐标；3：签名域）
                      type: '1',
                      // 签字/盖章宽度
                      width: '75',
                      // 签字/盖章高度
                      height: '30'
                    }
                  ],
                  // 是否必填：是 医护人员编号，用户需要在系统中已导入、实名认证和采集了签字
                  userId: this.userData.employeeId
                }
              }
              // this.$message('CA已异步提交，无需等待')
              setTimeout(() => {
                // console.log('!!!!!!!!!!!!!!!!!!!!!!!', document.getElementById('printButtonA5').innerHTML)
                this.exportPDF({
                  customMargin: [15, 15], // [30, 40]
                  customElementId: 'printButtonA5',
                  caParams: caParams,
                  isJavaTransformPdf: true,
                  marginStyle: Base64.encode('<style>@page{margin: 8mm 5mm 5mm 5mm;}</style>'),
                  htmlBase: Base64.encode(document.getElementById('printButtonA5').innerHTML)

                })
              }, 5)
            }
          }
        })
      } else {
        this.loading.close()
        this.$message.error(res.msg)
      }
    },
    // 刷新页面
    caRefresh() {
      this.$parent.$parent.getInfo()
    }
  }
}
</script>
<style lang="scss">
</style>
