<template>
  <div style="width: 820px">
    <div style="width: 770px; margin-right: 35px; border-right: 1px dashed gray; padding-right: 35px">
      <div style="border: 1px solid black; padding: 5px">
        <table id="surgeryTable" style="border: 1px solid black; border-collapse: collapse; width: 100%">
          <tr>
            <th rowspan="2">手术及操作名称</th>
            <th rowspan="2" style="width: 70px">手术及操作日期</th>
            <th rowspan="2" style="width: 10px">手术级别</th>
            <th rowspan="2">手术及操作编码</th>
            <th colspan="3">手术及操作医师</th>
            <th rowspan="2" style="width: 30px">切口愈合等级</th>
            <th rowspan="2">麻醉方式</th>
            <th rowspan="2">麻醉医师</th>
          </tr>
          <tr>
            <th>术者</th>
            <th>I助</th>
            <th>II助</th>
          </tr>
          <tr v-for="n in 5" :key="n">
            <td style="padding: 3px">
              {{ patient.surgeryList[n - 1].name }}
            </td>
            <td style="padding: 3px; width: 70px">
              {{ patient.surgeryList[n - 1].date }}
            </td>
            <td style="text-align-last: center; width: 30px">
              {{ filterNameInDic(patient.surgeryList[n - 1].level, 'getOperateScale') }}
            </td>
            <td style="width: 70px">
              {{ patient.surgeryList[n - 1].code }}
            </td>
            <td style="width: 40px">
              {{ patient.surgeryList[n - 1].operatorName }}
            </td>
            <td style="width: 50px">
              {{ patient.surgeryList[n - 1].assistantOneName }}
            </td>
            <td style="width: 50px">
              {{ patient.surgeryList[n - 1].assistantTwoName }}
            </td>
            <td style="text-align-last: center">
              {{ filterNameInDic(patient.surgeryList[n - 1].cutHeal, 'getCutHealGrade') }}
            </td>
            <td>
              {{ filterNameInDic(patient.surgeryList[n - 1].anaesthesia, 'getAnaesthesia') }}
            </td>
            <td style="width: 40px">
              {{ patient.surgeryList[n - 1].anaesthesiaorName }}
            </td>
          </tr>
        </table>
        <div style="margin: 10px 8px 10px 0">
          离院方式:
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black">{{ filterNameInDic(patient.zyDismissWay, 'getZyDismissWay') }}</span>
          ，拟接收医疗机构名称:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 210px">{{ patient.dismissDestination }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          是否有出院31天内再住院计划:
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black">{{ filterNameInDic(patient.admissAgainInOneMonth, 'getHaveOrNot') }}</span>
          ，目的:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 300px">{{ patient.admissAgainPurpose }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          颅脑损伤患者昏迷时间: 入院前
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 30px">{{ patient.comaDaysBeforeAdmiss }}</span>
          天
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 30px">{{ patient.comaHoursBeforeAdmiss }}</span>
          小时
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 30px">{{ patient.comaMinutesBeforeAdmiss }}</span>
          分钟 <span style="margin-left: 8px">入院后</span>
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 30px">{{ patient.comaDaysAfterAdmiss }}</span>
          天
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 30px">{{ patient.comaHoursAfterAdmiss }}</span>
          小时
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 30px">{{ patient.comaMinutesAfterAdmiss }}</span>
          分钟
        </div>
        <div style="margin: 10px 8px 10px 0">
          住院费用（元）: 总费用
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 110px">{{ patient.totalCost }}</span>
          (自付金额:
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 110px">{{ patient.selfPay }}</span>
          )
        </div>
        <div style="margin: 10px 8px 10px 0">
          1.综合医疗服务类: (1)一般医疗服务费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.generalMedicalServiceFee }}</span>
          (2)一般治疗操作费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.generalTreatmentOperatingFee }}</span>
          (3)护理费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 50px">{{ patient.careFee }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          (4)其他费:
          <span style="margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.elseFee }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          2.诊断类: (5)病理诊断费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.pathologicDiagFee }}</span>
          (6)实验室诊断费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.experimentDiagFee }}</span>
          (7)影像学诊断费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.ctDiagFee }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          (8)临床诊断项目费:
          <span style="margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.clinicalDiagFee }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          3.治疗类: (9)非手术治疗项目费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.notSurgicalFee }}</span>
          (临床物理治疗费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.clinicalPhysicalFee }}</span>
          )
        </div>
        <div style="margin: 10px 8px 10px 0">
          (10)手术治疗费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.surgicalFee }}</span>
          (麻醉费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.anesthetizeFee }}</span>
          &nbsp;&nbsp;手术费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.surgeryFee }}</span>
          )
        </div>
        <div style="margin: 10px 8px 10px 0">
          4.康复类: (11)康复费:
          <span style="margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.recoverFee }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          5.中医类: (12)中医治疗费:
          <span style="margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.tcmTreatmentFee }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          6.西药类: (13)西药费:
          <span style="margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.westMedicineFee }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          7.中药类: (14)中成药费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.chinesePatentMedicineFee }}</span>
          (15)中草药费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.chineseHerbalMedicineFee }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          8.血液和血液制品类: (16)血费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 50px">{{ patient.bloodFee }}</span>
          (17)白蛋白类制品费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 50px">{{ patient.albuminProductsFee }}</span>
          (18)球蛋白类制品费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 50px">{{ patient.globulinProductsFee }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          (19)凝血因子类制品费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.coagulationFactorProductsFee }}</span>
          (20)细胞因子类制品费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.cytokineProductsFee }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          9.耗材类: (21)检查用一次性医用材料费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">
            {{ patient.costOfDisposableMedicalMaterialsForExamination }}
          </span>
          (22)治疗用一次性医用材料费:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">
            {{ patient.costOfDisposableMedicalMaterialsForTreatment }}
          </span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          (23)手术用一次性医用材料费:
          <span style="margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.costOfDisposableMedicalMaterialsForOperation }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          10.其他类: (24)其他费:
          <span style="margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 70px">{{ patient.otherFees }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          主要诊断治愈好转情况:
          <span style="margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; padding: 0 5px">
            {{ dismissStatusText(patient.disdiagList[0].dismissStatus) }}
          </span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          诊断符合情况: 门诊与出院
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; margin-right: 12px">{{
            filterNameInDic(patient.diagConform1, 'getDiagConform')
          }}</span>
          入院与出院
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black">{{
            filterNameInDic(patient.diagConform2, 'getDiagConform')
          }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          术前与术后
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; margin-right: 12px">{{
            filterNameInDic(patient.diagConform3, 'getDiagConform')
          }}</span>
          临床与病理
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; margin-right: 12px">{{
            filterNameInDic(patient.diagConform4, 'getDiagConform')
          }}</span>
          放射与病理
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black">{{
            filterNameInDic(patient.diagConform5, 'getDiagConform')
          }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          抢救情况: 抢救
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 90px">{{ patient.rescueTimes }}</span>
          次， 成功
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 90px">{{ patient.rescueSuccessTimes }}</span>
          次
        </div>
        <div style="margin: 10px 8px 10px 0">
          病例分型:
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; margin-right: 12px">
            {{ filterNameInDic(patient.caseClassification, 'getCaseClassification') }}
          </span>
          实施重症监护:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black">{{ filterNameInDic(patient.hasIcu, 'getHaveOrNot') }}</span>
          ，监护总时间:
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 30px">{{ patient.icuDays }}</span>
          天
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 30px">{{ patient.icuHours }}</span>
          小时
        </div>
        <div style="margin: 10px 8px 10px 0">
          单病种管理:
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; margin-right: 12px">{{
            filterNameInDic(patient.monopathyManagement, 'getYesOrNo')
          }}</span>
          实施临床路径管理:
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; margin-right: 12px">
            {{ filterNameInDic(patient.clinicalPathwayManagement, 'getClinicalPathwayManagement') }}
          </span>
          实施DRGs管理:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black">{{
            filterNameInDic(patient.drgsManagement, 'getDrgsManagement')
          }}</span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          抗生素使用:
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; margin-right: 12px">{{ filterNameInDic(patient.useAntibiotic, 'getYesOrNo') }}</span>
          细菌培养标本送检:
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; margin-right: 12px">{{ filterNameInDic(patient.bacilliculture, 'getYesOrNo') }}</span>
          法定传染病:
          <span style="display: inline-block; margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black">
            {{ filterNameInDic(patient.statutoryEpidemic, 'getStatutoryEpidemic') }}
          </span>
        </div>
        <div style="margin: 10px 8px 10px 0">
          肿瘤分期: T
          <span style="display: inline-block; width: 30px; padding: 0 4px; border-bottom: 1px solid black; margin-right: 12px">
            {{ filterNameInDic(patient.tumorLevelT, 'getTumorLevelT') }}
          </span>
          N
          <span style="display: inline-block; width: 30px; padding: 0 4px; border-bottom: 1px solid black; margin-right: 12px">
            {{ filterNameInDic(patient.tumorLevelN, 'getTumorLevelN') }}
          </span>
          M
          <span style="display: inline-block; width: 30px; padding: 0 4px; border-bottom: 1px solid black; margin-right: 12px">
            {{ filterNameInDic(patient.tumorLevelM, 'getTumorLevelM') }}
          </span>
          分期
          <span style="display: inline-block; width: 30px; padding: 0 4px; border-bottom: 1px solid black; margin-right: 18px">
            {{ filterNameInDic(patient.tumorLevel, 'getTumorLevel') }}
          </span>
          新生儿Apgar评分:
          <span style="display: inline-block; padding: 0 4px; border-bottom: 1px solid black; width: 50px">{{ patient.xxeApgar }}</span>
          分
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    patient: {
      type: Object,
      required: true,
    },
    dics: {
      type: Object,
      required: true,
    },
  },
  setup(props) {
    const dismissStatusText = (val) => {
      switch (val) {
        case 1:
        case '1':
          return '治愈'
        case 2:
        case '2':
          return '好转'
        case 3:
        case '3':
          return '未愈'
        case 4:
        case '4':
          return '死亡'
        case 9:
        case '9':
          return '其他'
        default:
          return ''
      }
    }

    const filterNameInDic = (val, dic) => {
      if (!val) {
        return ''
      }
      const dicValue = props.dics[dic]
      for (let i = 0; i < dicValue.length; i++) {
        const dicItem = dicValue[i]
        if (dicItem.code == val) {
          return dicItem.name
        }
      }
      return '-'
    }
    return {
      dismissStatusText,
      filterNameInDic,
    }
  },
}
</script>

<style scoped>
table,
th,
td {
  border: 1px solid black;
  border-collapse: collapse;
}
td,
th {
  height: 24px;
  padding-left: 4px;
}
</style>
