<div class="searchDataWrap">
  <div class="searchData">
    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
    <div class="searchDataItem">
      <span class="label">科室</span>：
      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzAllowClear nzPlaceHolder="请选择科室" [(ngModel)]="deptId" nzServerSearch nzShowSearch (nzOnSearch)="changeInp($event)">
        <ng-container *ngFor="let option of alldepart">
          <nz-option *ngIf="!isLoading" [nzLabel]="option.hospital.hosName + '-' + option.dept" [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="operation">
    <i class="icon_transport transport-gengduo" nz-tooltip nzTooltipTitle="更多搜索" (click)="showMore()"></i>
    <button nz-button class="btn default" (click)="search()">查询</button>
    <button nz-button class="btn default ml8" (click)="reset()">重置</button>
    <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
  </div>
</div>
<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.buildingDTO || fieldConfig.fields.floorDTO || fieldConfig.fields.deptTypeDTO">
  <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
  <span>{{fieldConfig.fields.userDTO?.name}}</span>
  <span>{{fieldConfig.fields.category1DTO?.category}}</span>
  <span>{{fieldConfig.fields.category2DTO?.category}}</span>
  <span>{{fieldConfig.fields.category3DTO?.category}}</span>
  <span>{{fieldConfig.fields.buildingDTO?.buildingName}}</span>
  <span>{{fieldConfig.fields.floorDTO?.floorName}}</span>
	<span>{{fieldConfig.fields.deptTypeDTO?.name}}</span>
</div>
<div class="tableWrap">
	<nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }"  [nzFooter]="footerTpl">
		<thead (nzSortChange)="sort($event)" nzSingleSort>
			<tr>
				<th [nzWidth]="widthStyle" *ngIf="parent==1" nzShowSort nzSortKey="parentOrders" [(nzSort)]="sortCurrent.parentOrders">父级科室(编码)</th>
				<th [nzWidth]="widthStyle" nzShowSort nzSortKey="orders" [(nzSort)]="sortCurrent.orders">科室名称(编码)</th>
				<th [nzWidth]="widthStyle" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
				<th [nzWidth]="widthStyle" nzShowSort nzSortKey="degreeCount" [(nzSort)]="sortCurrent.degreeCount">评价工单数</th>
				<th [nzWidth]="widthStyle" nzShowSort nzSortKey="oneStar" [(nzSort)]="sortCurrent.oneStar">一星</th>
				<th [nzWidth]="widthStyle" nzShowSort nzSortKey="twoStar" [(nzSort)]="sortCurrent.twoStar">二星</th>
				<th [nzWidth]="widthStyle" nzShowSort nzSortKey="threeStar" [(nzSort)]="sortCurrent.threeStar">三星</th>
				<th [nzWidth]="widthStyle" nzShowSort nzSortKey="fourStar" [(nzSort)]="sortCurrent.fourStar">四星</th>
				<th [nzWidth]="widthStyle" nzShowSort nzSortKey="fiveStar" [(nzSort)]="sortCurrent.fiveStar">五星</th>
				<th [nzWidth]="widthStyle" nzShowSort nzSortKey="totalStar" [(nzSort)]="sortCurrent.totalStar">评价总星数</th>
				<th [nzWidth]="widthStyle" nzShowSort nzSortKey="avgStar" [(nzSort)]="sortCurrent.avgStar">平均总星数</th>
			</tr>
		</thead>
		<tbody>
			<tr *ngFor="let data of listOfData">
				<td *ngIf="parent==1">{{ data.parentName || '无' }}<ng-container *ngIf="parent==1 && data.parentName">({{ data.parentCode }})</ng-container></td>
				<td>{{ data.deptName }}<ng-container *ngIf="data.deptCode">({{ data.deptCode }})</ng-container></td>
				<td class="text-sign" (click)="viewDetail1(data)">{{ data.sum }}</td>
				<td>{{ data.degreeCount }}</td>
				<td class="text-sign" (click)="viewDetail2(data)">{{ data.oneStar }}</td>
				<td class="text-sign" (click)="viewDetail3(data)">{{ data.twoStar }}</td>
				<td class="text-sign" (click)="viewDetail4(data)">{{ data.threeStar }}</td>
				<td class="text-sign" (click)="viewDetail5(data)">{{ data.fourStar }}</td>
				<td class="text-sign" (click)="viewDetail6(data)">{{ data.fiveStar }}</td>
				<td>{{ data.totalStar }}</td>
				<td>{{ data.avgStar }}</td>
			</tr>
		</tbody>
		<ng-template #footerTpl>
			<table class="footTable">
				<tr *ngFor="let data of listOfDataEnd">
					<td [ngStyle]="{width:widthStyle}" *ngIf="parent==1">{{ data.parentCode }}</td>
					<td [ngStyle]="{width:widthStyle}" *ngIf="parent==0">{{ data.deptCode }}</td>
					<td [ngStyle]="{width:widthStyle}" *ngIf="parent==1"></td>
					<td [ngStyle]="{width:widthStyle}" class="text-sign" (click)="viewDetail1(data, 'all')">{{ data.sum }}</td>
					<td [ngStyle]="{width:widthStyle}">{{ data.degreeCount }}</td>
					<td [ngStyle]="{width:widthStyle}" class="text-sign" (click)="viewDetail2(data, 'all')">{{ data.oneStar }}</td>
					<td [ngStyle]="{width:widthStyle}" class="text-sign" (click)="viewDetail3(data, 'all')">{{ data.twoStar }}</td>
					<td [ngStyle]="{width:widthStyle}" class="text-sign" (click)="viewDetail4(data, 'all')">{{ data.threeStar }}</td>
					<td [ngStyle]="{width:widthStyle}" class="text-sign" (click)="viewDetail5(data, 'all')">{{ data.fourStar }}</td>
					<td [ngStyle]="{width:widthStyle}" class="text-sign" (click)="viewDetail6(data, 'all')">{{ data.fiveStar }}</td>
					<td [ngStyle]="{width:widthStyle}">{{ data.totalStar }}</td>
					<td [ngStyle]="{width:widthStyle}">{{ data.avgStar }}</td>
				</tr>
			</table>
		</ng-template>
	</nz-table>
</div>
<div class="pagination">
  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
</div>

<!-- 详细搜索 -->
<app-search-more [fieldConfig]="fieldConfig" *ngIf="showSearchMore" [hosId]="hosId" [queryType]="queryType"  [dutyId]="dutyId"  [parentDutyId]="parentDutyId" (cancelEvent)="cancelEvent()" (submitEvent)="submitEvent($event)"></app-search-more>
