<div class="header">
  <div class="display_flex align-items_center">
    <div class="dept">{{deptDisplay == 2 ? deptDTO.deptalias : deptDTO.dept}}</div>
    <div class="yyTime">
      <span class="label">预约时间：</span>
      <nz-range-picker nzShowTime [(ngModel)]="dateRange" (nzOnCalendarChange)="onCalendarChangeDate($event)"></nz-range-picker>
    </div>
    <div class="patient">
      <span class="label">患者：</span>
      <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择患者" [(ngModel)]="patientId" nzServerSearch nzShowSearch (nzOnSearch)="changeInp('patient', $event)" (nzOpenChange)="openChangePatient($event)" (ngModelChange)="changePatientId($event)">
        <ng-container *ngFor="let option of patientList">
          <nz-option *ngIf="!isLoading" [nzLabel]="option.patientName" [nzValue]="option.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>
  <div class="display_flex align-items_center">
    <button nz-button class="btn default" (click)='addPatientList()'>批量添加患者</button>
    <div class="info">
      <span>患者:{{listOfData.length}}</span>
      <span class="ml8">检查项:{{inspectTotalCount}}</span>
    </div>
  </div>
</div>
<div class="table">
  <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1">
    <thead>
      <tr class="thead">
        <th nzWidth="20%">患者信息</th>
        <th nzWidth="20%">护理信息</th>
        <th nzWidth="20%">陪检方式</th>
        <th nzWidth="20%">检查项目</th>
        <th nzWidth="20%">操作</th>
      </tr>
    </thead>
    <tbody>
      <tr *ngFor="let data of listOfData">
        <td><span class="patient"><span class="circle" [ngClass]="{ red: data.state && data.state.value == 1 }"></span>{{data.patientName}}<ng-container *ngIf="data.age !== undefined">({{data.age}}岁)</ng-container></span><br><ng-container *ngIf="data.patientType && data.patientType.value == 'I'">住：{{data.patientCode}}（{{data.bedNum}}）</ng-container><ng-container *ngIf="data.patientType && data.patientType.value == 'O'">门诊：{{data.patientCode}}</ng-container><ng-container *ngIf="data.patientType && data.patientType.value == 'E'">急：{{data.patientCode}}</ng-container></td>
        <td>{{data.careLevel?.name}}<br>{{data.illnessState?.name}}</td>
        <td>
          <nz-radio-group [(ngModel)]="data.tripType" (ngModelChange)="changeTripType($event, data.id)">
            <label nz-radio class="display_block" [nzValue]="item.id" *ngFor="let item of workOrderInspectScoreList">{{item.inspectMode}}</label>
          </nz-radio-group>
        </td>
        <td>
          <div *ngFor="let inspect of data.inspectList" class="display_flex align-items_center justify-content_flex-center">
            {{inspect.inspectName}} {{inspect.yyTime}}
            <span class="icon_transport transport-weibiaoti2010104" (click)="editInspect({data: data, inspect: inspect})"></span>
            <span class="icon_transport transport-shanchu1" (click)="showDelModal({data: data, inspect: inspect}, '您确认要删除吗？','删除','delInspect')"></span>
          </div>
        </td>
        <td>
          <div class="coop">
            <span (click)="addInspect(data)">追加项目</span>
            <span (click)="showDelModal(data, '您确认要移除患者吗？','移除患者','del')">移除患者</span>
          </div>
        </td>
      </tr>
    </tbody>
  </nz-table>
</div>
<div class="footer display_flex align-items_center justify-content_flex-center">
  <button nzType="primary" class="btn" nz-button (click)='addYytime()' *ngIf="listOfData.length">批量发起陪检</button>
  <button nz-button class="btn default ml8" (click)="showDelModal({}, '您确认要清空所有计划中的陪检信息吗？','重置','reset')">重置</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()" [content]="tipsMsg1"></app-dialog-delete>

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

<!-- 修改检查 -->
<app-select-date [date]="coopData.inspect && coopData.inspect.yyTime" *ngIf="isShowSelectDate" (submitFormHand)="submitSelectDate($event)" (cancelFlagHand)="cancelSelectDate($event)"></app-select-date>

<!-- 批量发起陪检 -->
<app-select-date-yytime [date]="dateRange.length && dateRange[0]" *ngIf="isShowSelectDateYytime" (submitFormYytimeE)="submitSelectDateYytime($event)" (submitFormDirectE)="submitSelectDateDirect($event)" (cancelFlagHand)="cancelSelectDateYytime($event)"></app-select-date-yytime>

<!-- 追加患者检查 -->
<app-add-inspect-modal *ngIf="isShowAddInspect" [patientInspectLogDTO]="patientInspectLogDTO" [deptDisplay]="deptDisplay" (closeModelHs)="closeAddInspectModel($event)" (confirmModelHs)="confirmAddInspectModel($event)"></app-add-inspect-modal>
