<div class="header">
  <div class="display_flex align-items_center">
    <div class="dept">标本打包-{{deptDisplay == 2 ? deptDTO.deptalias : deptDTO.dept}}</div>
  </div>
  <input class="specimenCode" #specimenCodeElement nz-input placeholder="可扫描标本条码快速添加" [(ngModel)]="specimenCode" (input)="inputChange($event)" />
  <div class="display_flex align-items_center">
		<button nz-button class="btn default" (click)="batchDel()">批量移除</button>
    <button nz-button class="btn default ml8" (click)="showDelModal({}, '您确认要重置标本吗，重置会先清空标本在根据规则自动清点？','重置标本','reset')">重置标本</button>
    <button nz-button nzType="default" class="ml8" *ngIf="configs.spePackageAutoPack == 1" (click)='showPackageSpecimenRule()'>自动清点规则</button>
  </div>
</div>
<div class="table display_flex">
  <div class="filter display_flex flex-direction_column">
    <div class="total">总标本数：{{total}}</div>
    <div class="block display_flex flex-direction_column patient" *ngIf="typeSpecimentList.length">
      <div class="block_title">试管类型</div>
      <div class="block_content">
        <div class="block_item" *ngFor="let item of typeSpecimentList" (click)="clickType(item)" [ngClass]="{'active': item.id == activeTypeId}">{{item.name}}：{{item.size}}</div>
      </div>
    </div>
    <div class="block display_flex flex-direction_column patient" *ngIf="patientSpecimentList.length">
      <div class="block_title">患者</div>
      <div class="block_content">
        <div class="block_item" *ngFor="let item of patientSpecimentList" (click)="clickPatient(item)" [ngClass]="{'active': item.no == activePatientNo}">{{item.name}}：{{item.size}}</div>
      </div>
    </div>
  </div>
  <nz-table class="list-template__nzTable filter_table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1">
    <thead>
      <tr class="thead">
				<th nzWidth="5%" nzShowCheckbox [(nzChecked)]="isAllDisplayDataChecked"
				  (nzCheckedChange)="checkAll($event)"></th>
        <th nzWidth="11%">患者姓名</th>
        <th nzWidth="11%">住院号</th>
        <th nzWidth="11%">标本条码</th>
        <th nzWidth="11%">检验项目</th>
        <th nzWidth="11%">类型</th>
        <th nzWidth="11%">采集人</th>
        <th nzWidth="11%">采集时间</th>
        <th nzWidth="11%">检验科室</th>
        <th nzWidth="12%">操作</th>
      </tr>
    </thead>
    <tbody>
      <tr *ngFor="let data of listOfData">
				<td nzShowCheckbox [(nzChecked)]="mapOfCheckedId[data.id]" (nzCheckedChange)="refreshStatus()"></td>
        <td>{{ data.patientName }}<span *ngIf="data.bedNum">({{ data.bedNum }})</span></td>
        <td>{{ data.residenceNo }}</td>
        <td>{{ data.scode }}</td>
        <td>{{ data.specimenDesc }}</td>
        <td>{{ data.stype?.name }}<span *ngIf="data.tubeType">({{ data.tubeType?.name }})</span></td>
        <td>{{ data.collectNurseName }}</td>
        <td>{{ data.printDate }}</td>
        <td>{{ data.checkDept?.dept }}</td>
        <td>
          <div class="coop">
            <span (click)="showDelModal(data, '您确认要移除吗？','移除','del')">移除</span>
          </div>
        </td>
      </tr>
    </tbody>
  </nz-table>
</div>
<div class="bottom-content">
	<span class="mal-50">包号：{{package.packCode}}</span>
	<span>状态：{{package.status?.name}}</span>
</div>
<div class="footer display_flex align-items_center justify-content_flex-center">
  <button nzType="primary" class="btn" nz-button (click)='packageHandler()' *ngIf="this.total > 0 && package.status.value === '0'">打包</button>
  <button nzType="primary" class="btn" nz-button (click)='printPackage()' *ngIf="this.total > 0 && package.status.value === '1'">补打</button>
  <button nzType="default" nz-button class="btn cancel ml8" (click)='goBack()'>取消</button>
</div>

<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo">
</app-prompt-modal>

<!-- 删除模态框 -->
<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
(confirmDelEvent)="confirmDel($event)" [content]="tipsMsg1" [isShowEndDeptId]="isShowEndDeptId" [isShowEndDeptIdArr]="isShowEndDeptIdArr"></app-dialog-delete>

<app-package-specimen-rule *ngIf="isShowPackageSpecimenRule" (cancelFlagHand)="closePackageSpecimenRule($event)"></app-package-specimen-rule>

<!-- 遮罩 -->
<app-mask *ngIf="maskFlag"></app-mask>

<!-- 打印的内容 -->
<div id="print-section" hidden>
  <!-- 80mm*80mm -->
  <div style="overflow: hidden;padding: 2mm;font-size: 4mm;width: 75mm;height: 75mm;" *ngIf="configs.spePackageCodeSize == 1">
    <div style="display: flex;">
      <img [src]="base64" style="width: 23mm;height: 23mm;margin-right: 3mm;">
      <div style="flex: 1;">
        <div>包号：{{package.packCode}}</div>
        <div style="margin-top: 3mm;">打包人：{{package.packUserDTO?.name}}</div>
        <div style="margin-top: 3mm;">标本总数：{{package.specimenNum}}</div>
      </div>
    </div>
    <div style="margin-top: 3mm;">打包时间：{{package.packTime | date: 'yyyy-MM-dd HH:mm'}}</div>
    <div style="margin-top: 3mm;">打包科室：{{package.packDeptDTO?.dept}}</div>
    <div style="margin-top: 3mm;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">终点科室：{{package.targetDeptDTO?.dept}}</div>
    <div style="display: flex;flex-wrap: wrap;" *ngIf="configs.spePrintTubeType == 1">
      <div style="width: 33.33%;margin-top: 3mm;" *ngFor="let item of typeSpecimentList | slice:0:9">{{item.name}}：{{item.size}}</div>
    </div>
  </div>
  <!-- 70mm*50mm -->
  <div style="overflow: hidden;padding: 2mm;font-size: 4mm;width: 65mm;height: 45mm;" *ngIf="configs.spePackageCodeSize == 2">
    <div style="display: flex;">
      <img [src]="base64" style="width: 23mm;height: 23mm;margin-right: 3mm;">
      <div style="flex: 1;">
        <div>包号:{{package.packCode}}</div>
        <div>{{package.packDeptDTO?.dept}}</div>
        <div>{{package.packTime | date: 'yyyy-MM-dd HH:mm'}}</div>
        <div>{{package.specimenNum}};{{package.packUserDTO?.name}}</div>
      </div>
    </div>
    <div style="display: flex;flex-wrap: wrap;" *ngIf="configs.spePrintTubeType == 1">
      <div *ngFor="let item of typeSpecimentList">{{item.name}}:{{item.size}}</div>
    </div>
  </div>
</div>
<button ngxPrint printSectionId="print-section" #printBtn hidden [printStyle]="{ '@page': { margin: '0 !important' }, 'body': { margin: '0 !important' } }">打印</button>
