<div class="list-template">
  <div class="list-template__content">
    <div class="list-template__top" nz-row>
      <div nz-col nzXl="18" class="list-template__searchBox">
        <div class="list-template__searchItem">
          <span class="label">收取科室：</span>
          <nz-select
            [nzDropdownMatchSelectWidth]="false"
            class="formItem"
            nzServerSearch
            nzShowSearch
            nzAllowClear
            nzPlaceHolder="请选择收取科室"
            [(ngModel)]="searchCriteria.department"
            (nzOnSearch)="changeInp($event, 'search')"
            (nzOpenChange)="changeSearch($event)"
          >
            <ng-container *ngFor="let data of departmentSearch">
              <nz-option
                *ngIf="!isLoading"
                nzLabel="{{ data.dept }}"
                nzValue="{{ data.id }}"
              ></nz-option>
            </ng-container>
            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
            </nz-option>
          </nz-select>
        </div>
        <div class="list-template__searchItem">
          <span class="label">终点科室：</span>
          <nz-select
            [nzDropdownMatchSelectWidth]="false"
            class="formItem"
            nzServerSearch
            nzShowSearch
            nzAllowClear
            nzPlaceHolder="请选择终点科室"
            [(ngModel)]="searchCriteria.checkDept"
            (nzOnSearch)="changeInp($event, 'search')"
            (nzOpenChange)="changeSearch($event)"
          >
            <ng-container *ngFor="let data of departmentSearch">
              <nz-option
                *ngIf="!isLoading"
                nzLabel="{{ data.dept }}"
                nzValue="{{ data.id }}"
              ></nz-option>
            </ng-container>
            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
            </nz-option>
          </nz-select>
        </div>
        <div class="list-template__searchItem">
          <span class="label">标本编码：</span>
          <input
            nz-input
            class="formItem"
            placeholder="请输入标本编码"
            [(ngModel)]="searchCriteria.scode"
          />
        </div>
        <div class="list-template__searchItem">
          <span class="label">患者信息：</span>
          <input
            nz-input
            class="formItem"
            placeholder="请输入患者信息"
            [(ngModel)]="searchCriteria.parent"
          />
        </div>
        <div class="list-template__searchItem">
          <span class="label">状态：</span>
          <nz-select
            [nzDropdownMatchSelectWidth]="false"
            class="formItem"
            nzServerSearch
            nzShowSearch
            nzAllowClear
            nzPlaceHolder="请选择状态"
            [(ngModel)]="searchCriteria.speState"
            (nzOpenChange)="changeSearch1($event)"
          >
            <ng-container *ngFor="let data of types">
              <nz-option
                *ngIf="!isLoading1"
                nzLabel="{{ data.name }}"
                nzValue="{{ data.id }}"
              ></nz-option>
            </ng-container>
            <nz-option *ngIf="isLoading1" nzDisabled nzCustomContent>
              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
            </nz-option>
          </nz-select>
        </div>
        <div class="list-template__searchItem">
          <span class="label">收取人：</span>
          <nz-select
            [nzDropdownMatchSelectWidth]="false"
            class="formItem"
            nzServerSearch
            nzShowSearch
            nzAllowClear
            nzPlaceHolder="请选择收取人："
            [(ngModel)]="searchCriteria.receiverName"
            (nzOnSearch)="changeInp2($event, 'search')"
            (nzOpenChange)="changeSearch2($event)"
          >
            <ng-container *ngFor="let data of userSearch">
              <nz-option
                *ngIf="!isLoading"
                nzLabel="{{ data.name }}"
                nzValue="{{ data.id }}"
              ></nz-option>
            </ng-container>
            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
            </nz-option>
          </nz-select>
        </div>
        <div class="list-template__searchItem">
          <span class="label">收取时间：</span>
          <nz-range-picker [(ngModel)]="searchCriteria.dateRange" (ngModelChange)="changeDate($event)"></nz-range-picker>
        </div>

      </div>
      <div nz-col nzXl="6" class="list-template__btns">
        <!-- <button
          nz-button
          class="btn default"
          (click)="showDelModal('您确认要清空标本吗？')"
          *ngIf="currentUserAccount == 'dsadmin'"
        >
          清空标本
        </button> -->
        <button nz-button class="btn default ml8" (click)="reset()">
          重置
        </button>
        <button nz-button class="btn default ml8" (click)="getList(1)">
          搜索
        </button>
      </div>
    </div>
    <div class="list-template__checkBoxes">
      <div><nz-checkbox-group [(ngModel)]="checkOptionsOne" (ngModelChange)="log(checkOptionsOne)"></nz-checkbox-group></div>
      <div>合计：{{listLength}}</div>
    </div>
    <div class="list-template__bottom">
      <nz-table
        class="list-template__nzTable"
        #headerTable
        [nzData]="listOfData"
        nzSize="middle"
        [nzShowPagination]="false"
        [nzLoading]="loading1"
      >
        <thead (nzSortChange)="sort($event)" nzSingleSort>
          <tr class="thead">
            <th nzWidth="4%">序号</th>
            <th nzWidth="8%">申请科室</th>
            <th nzWidth="7%">患者姓名</th>
            <th nzWidth="5%">标本编码</th>
            <th nzWidth="8%">检验项目</th>
            <th nzWidth="8%">标本类型</th>
            <th nzWidth="5%">状态</th>
            <th nzWidth="8%" nzShowSort nzSortKey="arrive_time" [(nzSort)]="sortCurrent.arrive_time">收取时间</th>
            <th nzWidth="8%">收取人</th>
            <th nzWidth="8%">中转时间</th>
            <th nzWidth="8%">送达时间</th>
            <th nzWidth="8%">送达人</th>
            <th nzWidth="8%">终点科室</th>
            <th nzWidth="7%"></th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData; let i = index">
            <td>{{i+(pageIndex-1) * pageSize + 1}}</td>
            <td>{{ data.sickRoom ? data.sickRoom.dept : "-" }}</td>
            <td>{{ data.patientName}}<span *ngIf="data.bedNum">({{data.bedNum}})</span><br>{{data.residenceNo}}</td>
            <td>{{ data.scode || "-" }}</td>
            <td>{{ data.specimenDesc || "-" }}</td>
            <td>{{ data.stype ? data.stype.name : "-" }}</td>
            <td>{{ data.speState ? data.speState.name : "-" }}</td>
            <td>{{ data.arriveTime || "-" }}</td>
            <td>{{ data.receiverName || "-" }}</td>
            <td>{{ data.transTime || '-' }}</td>
            <td>{{ data.sendTime || '-' }}</td>
            <td>{{ data.delivererName || "-" }}</td>
            <td>{{ data.checkDept ? data.checkDept.dept : "-" }}</td>
            <td><button (click)="viewSpecimenHistory(data)">查看</button></td>
          </tr>
        </tbody>
      </nz-table>
      <div class="list-template__pagination">
        <nz-pagination
          [(nzPageIndex)]="pageIndex"
          [(nzTotal)]="listLength"
          [(nzPageSize)]="pageSize"
          (nzPageIndexChange)="getList(0, sortCurrentKey, sortCurrentValue)"
          (nzPageSizeChange)="getList(0, sortCurrentKey, sortCurrentValue)"
        >
        </nz-pagination>
      </div>
    </div>
  </div>
</div>
<!-- 清空标本模态框 -->
<app-dialog-delete
  [delModal]="delModal"
  (hideDelModalEvent)="hideDelModal()"
  [btnLoading]="btnLoading"
  (confirmDelEvent)="confirmDel()"
  [content]="tipsMsg1"
></app-dialog-delete>
<!-- 标本历史记录查看 -->
<app-history-prompt-modal
  *ngIf="historyPromptModalShow"
  [show]="historyPromptModalShow"
  [scode]="scode"
  (closeModelHs)="closeModelHistory($event)"
></app-history-prompt-modal>
<!-- 操作成功/失败提示框 -->
<app-prompt-modal
  *ngIf="promptModalShow"
  [content]="promptContent"
  [success]="ifSuccess"
  [show]="promptModalShow"
  [info]="promptInfo"
>
</app-prompt-modal>
