<div class="list-template">
  <div class="list-template__content">
    <div class="list-template__top" nz-row>
      <div nz-col nzLg='20' class="list-template__searchBox">
        <div class="list-template__searchItem">
          <span class="label">批次号：</span>
          <input nz-input class="formItem" [(ngModel)]="batchNumber" placeholder="请输入批次号" nzSize="default" />
        </div>
        <div class="list-template__searchItem">
          <span class="label">创建时间：</span>
          <nz-range-picker [(ngModel)]="dateRange" nzFormat="yyyy-MM-dd HH:mm:ss"
					(ngModelChange)="changeDate($event)"></nz-range-picker>
        </div>
      </div>
      <div nz-col nzLg="4" class="list-template__btns">
        <button class="btn default" (click)='search()'>搜索</button>
        <button class="btn default ml8" (click)='reset()'>重置</button>
      </div>
    </div>
    <div class="list-template__bottom">
      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
        [nzLoading]="loading1">
        <thead>
          <tr class="thead">
						<th>批次号</th>
            <th>创建时间</th>
						<th>核对人</th>
						<th>配送人</th>
						<th>申请单数</th>
            <th>标本数</th>
            <th nzWidth="120px">操作</th>
          </tr>
        </thead>
        <tbody v-if="listOfData && listOfData.length>0">
          <tr *ngFor="let data of listOfData">
            <td>{{ data.batchNo || '-' }}</td>
            <td>{{ data.createTime|date:'yyyy-MM-dd HH:mm'}}</td>
            <td>{{ data.checkUserDTO?data.checkUserDTO.name:'' }}</td>
						<td>{{ data.deliverUserDTO?data.deliverUserDTO.name:'' }}</td>
						<td>{{ data.pathologyFormNum||'0' }}</td>
						<td>{{ data.specimenNum||'0' }}</td>
            <td>
              <div class="coop">
                <span *ngIf="coopBtns.look" (click)="viewSingle(data)">查看申请单</span>
              </div>
            </td>
          </tr>
        </tbody>
      </nz-table>
      <div class="list-template__pagination">
        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
        </nz-pagination>
      </div>
    </div>
  </div>

  <!-- 查看申请单 -->
  <div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
    <div class="modalBody">
      <div class="title">申请单列表<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
      </div>
      <overlay-scrollbars #osComponentRef1 class="content">
        <div class="list-template__bottom">
        	<nz-table class="list-template__nzTable" [nzData]="viewData" nzSize="middle" [nzShowPagination]="false"
        		[nzLoading]="grossLoading">
        		<thead>
        			<tr class="thead">
        				<th>申请单类型</th>
        				<th>申请单号</th>
								<th>申请科室</th>
								<th>操作科室</th>
								<th>患者信息</th>
        				<th nzWidth="20%">检验项目</th>
								<th>部位</th>
        				<th>标本数</th>
        				<th nzWidth="100px">操作</th>
        			</tr>
        		</thead>
        		<tbody>
        			<tr *ngFor="let data of viewData">
        				<td *ngIf="data.pathologyFormType==1" class="red">术中快速</td>
        				<td *ngIf="data.pathologyFormType==0">普通病理</td>
        				<td *ngIf="data.pathologyFormType==2">病理细胞学</td>
        				<td style="text-decoration: underline;cursor: pointer;" (click)="itemClick(data)">{{ data.applyCode}}</td>
        				<td>{{ data.patientDTO? data.patientDTO.department.dept:'-'}}</td>
								<td>{{ data.surgeryDeptDTO? data.surgeryDeptDTO.dept:'-'}}</td>
        				<td>{{ data.patientDTO.patientName}} ({{data.patientDTO.bedNum}}床)</td>
								<td>{{ data.arr ? data.arr.join('、') : '无' }}</td>
								<td>{{ data.takePart}}</td>
								<td>{{ data.specimenNum}}</td>
        				<td>
        				  <div class="coop">
        				    <span (click)="itemClick(data)">查看</span>
        				  </div>
        				</td>
        			</tr>
        		</tbody>
        	</nz-table>
        </div>
      </overlay-scrollbars>
      <div class="display_flex justify-content_flex-center">
        <button class="btn" nz-button nzType="primary" (click)="hideModal()">知道了</button>
      </div>
    </div>
  </div>
</div>

<!-- 标本查看详情-->
<div class="pathology-box display_flex align-items_center justify-content_flex-center" *ngIf="detailMoadl">
	<div class="pathology-content">
		<div class="title">查看详情
		<i class="icon_transport transport-guanbi" (click)="closeDetailMoadl()"></i></div>
		<div class="content">
			<div class="content-item boder-right">
				<nz-form-item class="form-title-box">
					<div class="form-title">申请单类型：{{detailsData.pathologyFormType==1?'术中快速病理检查申请单' : detailsData.pathologyFormType==2 ? '病理细胞学申请单' : '病理检查申请单'}}</div>
					<div class="form-title"><span class="font-weight-500">状态：</span>{{detailsData.status?detailsData.status.name:'-'}}</div>
				</nz-form-item>
				<nz-form-item class="form-title-box">
					<div class="form-title"><span class="font-weight-500">申请单号：</span>{{detailsData.applyCode}}</div>
					<div class="form-title over-class"><span class="font-weight-500">申请科室：</span>{{detailsData.patientDTO.department.dept}}</div>
				</nz-form-item>
				<nz-form-item class="form-title-box">
					<div class="form-title">手术间：{{detailsData.surgeryDeptDTO.dept}}</div>
					<div class="form-title">取材医生：{{detailsData.surgeryDoctorDTO?detailsData.surgeryDoctorDTO.name : '-'}}</div>
				</nz-form-item>
				<nz-form-item class="form-title-box">
					<div class="form-title"><span class="font-weight-500">患者信息：</span>{{detailsData.patientDTO.patientName}} ({{detailsData.patientDTO.bedNum}}床)</div>
					<div class="form-title"><span class="font-weight-500">年龄：</span>{{detailsData.patientDTO.age||'-'}}</div>
					<div class="form-title"><span class="font-weight-500">性别：</span>{{detailsData.patientDTO.gender?detailsData.patientDTO.gender.name:'-'}}</div>
					<div class="form-title"><span class="font-weight-500">住院号：</span>{{detailsData.patientDTO.patientCode}}</div>
				</nz-form-item>
				
				<div class="form-title-box">
					<div class="form-title"><span class="font-weight-500">检验项目：</span>{{project||'无'}}</div>
				</div>
				
				<div class="form-list">
					<div class="form-title font-weight-500">诊断：</div>
					<div class="indent">
						{{detailsData.diagnose||'无'}}
					</div>
				</div>
				
				<div class="form-list">
					<div class="form-title font-weight-500">病历摘要：</div>
					<div class="indent">{{detailsData.medicalRecords||'无'}}</div>
				</div>
				<div class="form-list">
					<div class="form-title font-weight-500">手术方案：</div>
					<div class="indent">{{detailsData.surgicalPlan||'无'}}</div>
				</div>
				<div class="form-list">
					<div class="form-title font-weight-500">术中所见：</div>
					<div class="indent">{{detailsData.intraoperativeFindings||'无'}}</div>
				</div>

				<div class="form-title-box">
					<div class="form-title"><span class="font-weight-500">标本类型：</span>{{detailsData.specimenType.name||'无'}}</div>
					<div class="form-title"><span class="font-weight-500">标本数量：</span>{{detailsData.specimenNum||'无'}}</div>
				</div>
				
				<div class="form-title-box">
					<div class="form-title"><span class="font-weight-500">部位：</span>{{detailsData.takePart||'无'}}</div>
					<!-- <div class="form-title"><span class="font-weight-500">离体时间：</span>{{detailsData.inVitroTime?(detailsData.inVitroTime|date:'yyyy-MM-dd HH:mm:ss'):'无'}}</div> -->
					<!-- <div class="form-title"><span class="font-weight-500">固定时间：</span>{{detailsData.fixationTime?(detailsData.fixationTime|date:'yyyy-MM-dd HH:mm:ss'):'无'}}</div> -->
				</div>
				
				<div class="form-list">
					<div class="form-title font-weight-500">标本：</div>
					<div class="form-title specimen-list">
						<div *ngFor="let item of specimenList" class="specimen-item-class" (click)="specimenView(item)">
							<span *ngIf="item.partSource && item.partSource.value!=1">{{item.partSource?item.partSource.name:''}}</span>{{item.specimenName}}({{item.specimenCode}})
						</div>
					</div>
				</div>

			</div>
			
			<div class="content-item-right">
				<div class="step-title">病理闭环</div>
				<nz-steps [nzCurrent]="stepLength" nzDirection="vertical" nzSize="small">
					<ng-container *ngFor="let item of pathologyLogs; let index = index">
							<nz-step
								[nzDescription]="tpl"
							>
							</nz-step>
							<ng-template #tpl>
								<div *ngIf="index==pathologyLogs.length-1" class="step-size">
									<div style="color: #49B856;" *ngIf="item.doctorDTO"> {{item.operationType?item.operationType.name:''}} {{item.doctorDTO?item.doctorDTO.name:''}} {{item.nurseDTO?item.nurseDTO.name:''}} </div>
									<div style="color: #49B856;" *ngIf="!item.doctorDTO">{{item.operationType?item.operationType.name:''}}  {{item.handoverUserDto?item.handoverUserDto.name:''}}</div>
									<div style="color:#333;">{{item.createTime|date:'yyyy-MM-dd HH:mm:ss'}} {{item.operationUserDto?item.operationUserDto.name:''}}</div>
								</div>
								<div *ngIf="index!=pathologyLogs.length-1" class="step-size">
									<div *ngIf="item.doctorDTO">{{item.operationType?item.operationType.name:''}}  {{item.doctorDTO?item.doctorDTO.name:''}} {{item.nurseDTO?item.nurseDTO.name:''}}</div>
									<div *ngIf="!item.doctorDTO">{{item.operationType?item.operationType.name:''}}  {{item.handoverUserDto?item.handoverUserDto.name:''}}</div>
									<div>{{item.createTime|date:'yyyy-MM-dd HH:mm:ss'}} {{item.operationUserDto?item.operationUserDto.name:''}}</div>
								</div>
							</ng-template>
						</ng-container>
				</nz-steps>
			</div>
		</div>
		<div class="display_flex justify-content_flex-center bottom-btn">
			<button class="btn btn-right" nz-button nzType="primary" (click)="closeDetailMoadl()">知道了</button>
		</div>
	</div>
</div>

<!-- 查看标本 -->
<div class="look">
	<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="specimenViewDialog">
		<div class="modalBody modalBody-ga">
			<div class="title">查看标本<i class="icon_transport transport-guanbi" (click)="closeSpecimenModal()"></i>
			</div>
			<overlay-scrollbars #osComponentRef1 class="content">
				<div class="list-template__bottom">
					<nz-table class="list-template__nzTable" [nzData]="specimenData" nzSize="middle" [nzShowPagination]="false"
					  [nzLoading]="loading1">
					  <thead>
					    <tr class="thead">
								<th>标本名称</th>
								<th>系统</th>
								<th>部位</th>
					      <th>编码</th>
					      <th>备注</th>
					      <th>离体时间</th>
					      <th>离体操作人</th>
					      <th>固定时间</th>
					      <th>固定操作人</th>
					    </tr>
					  </thead>
					  <tbody>
					    <tr *ngFor="let data of specimenData">
								<td>{{ data.specimenName }}</td>
								<td>{{ data.system ? data.system.name : '-' }}</td>
								<td>{{ data.organ ? data.organ.name : '-' }}</td>
					      <td>{{ data.specimenCode }}</td>
					      <td>{{ data.remark ? data.remark : '无' }}</td>
								<td>{{ data.inVitroTime ? (data.inVitroTime|date:'yyyy-MM-dd HH:mm:ss') : '-' }}</td>
								<td>{{ data.inVitroOperator ? data.inVitroOperator.name : '-' }}</td>
								<td>{{ data.fixationTime ? (data.fixationTime|date:'yyyy-MM-dd HH:mm:ss') : '-' }}</td>
								<td>{{ data.fixationOperator ? data.fixationOperator.name : '-' }}</td>
					    </tr>
					  </tbody>
					</nz-table>
				</div>
			</overlay-scrollbars>
			<div class="display_flex justify-content_flex-center">
				<button class="btn" nz-button nzType="primary" (click)="closeSpecimenModal()">知道了</button>
			</div>
		</div>
	</div>
</div>
<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo"></app-prompt-modal>

