<div class="pharmacy">
  <!-- 头部 start -->
  <div class="pharmacy-header">
   <div class="pharmacy-logo">
			<div class="pharmacy-name__title">一站式服务管理平台</div>
    </div>
    <div class="pharmacy-name">
			<div class="pharmacy-title">标本交接本</div>
      <div class="pharmacy-name__total">
				<nz-input-group nzSize="large">
					<input type="text" id="Binput" (ngModelChange)="specimenCodeChange($event)" [(ngModel)]="barCode" nz-input placeholder="可扫描物理标本条码及申请单" />
				</nz-input-group>
				<!-- <ng-template #suffixButton>
					<button nz-button nzType="primary" nzSize="large" nzSearch (click)="searchSpecimen()">搜索</button>
				</ng-template> -->
      </div>
			<div class="error-box">
				<div class="error-class">{{searchMsg}}</div>
			</div>
    </div>
    <div class="right">
      <div class="userInfo dropdown">
        <div class="user" (mouseenter)="showDropdown = true" (mouseleave)="showDropdown = false">
          <img src="../../assets/images/icon_keshi.png" alt="">
          <span><ng-container *ngIf="loginUser.dept">{{deptDisplay == 2 ? loginUser.dept.deptalias : loginUser.dept.dept}}-</ng-container>{{loginUser.name}}</span>
          <i class="icon_transport transport-xiala1 ml8"></i>
        </div>
        <div class="dropdown-content r8" [hidden]="!showDropdown" (mouseenter)="showDropdown = true" (mouseleave)="showDropdown = false">
          <div class="dropdownItem" (click)="changeKsNow()">切换科室</div>
					<div class="dropdownItem" (click)="toMain()">回到系统管理</div>
          <div class="dropdownItem" (click)="logOut()">退出</div>
        </div>
      </div>
    </div>
  </div>
	<div class="communication-tip">
		<div class="mar-ri-30" *ngIf="toDayData">
			今日产生：
			申请单 <span class="weight">{{toDayData.pathologyFormNum || 0}}</span> &nbsp;
			标本 <span class="weight">{{toDayData.specimenNum || 0}}</span>&nbsp;
			速冻 <span class="weight">{{toDayData.rapidityNum || 0}}</span>&nbsp;
		</div>
	  <div class="mar-ri-30" *ngIf="toDayData">
	  	今日送出：
	  	申请单 <span class="weight">{{toDayData.sendOutPathologyFormNum || 0}}</span> &nbsp;
	  	标本 <span class="weight">{{toDayData.sendOutSpecimenNum || 0}}</span>&nbsp;
	  	速冻 <span class="weight">{{toDayData.sendOutRapidityNum || 0}}</span>&nbsp;
	  </div>
	</div>
	<div class="tabs">
		<div class="tabs-item">
			<div class="tabs-item-item" [ngClass]="{'activeClass': activeIndex == 0}" (click)="tabClick(0)">交接本</div>
			<div class="tabs-item-item"  *ngIf="coopBtns.print" [ngClass]="{'activeClass': activeIndex == 1}" (click)="tabClick(1)">未打印</div>
		</div>
		<div class="tabs-btn">
			<button class="btn default" nz-button nzType="primary" nzSize="small" (click)='distributionTab()'>配送清点</button>
		</div>
	</div>
  <!-- 头部 end -->
  <div class="pharmacy-main">
    <div class="list-template pharmacy-main__list pharmacy-main__print">
			<div class="list-template__content">
			  <div class="list-template__top" nz-row>
			    <div nz-col nzLg='18' class="list-template__searchBox">
			      <div class="list-template__searchItem">
			        <span class="label">离体时间：</span>
			        <nz-range-picker [(ngModel)]="acceptTime" nzFormat="yyyy-MM-dd HH:mm:ss"
							(ngModelChange)="changeDate($event)"></nz-range-picker>
			      </div>
						<div class="list-template__searchItem">
						  <span class="label">患者：</span>
							<input type="text" class="search-input" [(ngModel)]="deliveryUser" nz-input placeholder="请输入患者" />
<!-- 							<nz-select class="formItem" (nzOnSearch)="changeUserInp($event)"
							  [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear nzPlaceHolder="请选择患者"
							  [(ngModel)]="deliveryUser">
							  <ng-container *ngFor="let option of userData">
							    <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [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 class="list-template__searchItem">
						  <span class="label">状态：</span>
							<nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear nzPlaceHolder="请选择状态"
							  [(ngModel)]="status">
							  <ng-container *ngFor="let option of statusData">
							    <nz-option [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
							  </ng-container>
							</nz-select>
						</div>
						<div class="list-template__searchItem">
						  <span class="label">术中快速：</span>
							<nz-radio-group [(ngModel)]="pathologyFormType">
								<label nz-radio nzValue="1">是</label>
								<label nz-radio nzValue="0">否</label>
							</nz-radio-group>
						</div>
			    </div>
			    <div nz-col nzLg="6" class="list-template__btns">
			      <button class="btn default" (click)='search()'>搜索</button>
			      <button class="btn default ml8" (click)='reset()'>重置</button>
						<button class="btn default ml8" nz-button *ngIf="coopBtns.batchPrint && activeIndex==1" (click)="print('batchPrint')" [nzLoading]="btnLoading">批量打印</button>
			    </div>
			  </div>
			  <div class="list-template__bottom" *ngIf="activeIndex==0">
			    <nz-table class="list-template__nzTable" [nzData]="listOneData" nzSize="middle" [nzShowPagination]="false"
			      [nzLoading]="loading1">
			      <thead>
			        <tr class="thead">
			          <th nzWidth="14%">申请单号</th>
								<th nzWidth="100px">状态</th>
			          <th>患者姓名</th>
			          <th>住院号</th>
			          <th nzWidth="100px">部位</th>
			          <th>标本数</th>
			          <th>申请科室</th>
								<th>离体时间</th>
								<th>固定时间</th>
			          <th>配送人</th>
								<th>配送时间</th>
			          <th nzWidth="120px">操作</th>
			        </tr>
			      </thead>
			      <tbody>
			        <tr *ngFor="let data of listOneData">
			          <td><span *ngIf="data.pathologyFormType==1" style="color: red;">速 </span>{{ data.applyCode || '-' }}</td>
								<td> <span *ngIf="data.deleteFlag==1" class="orange">删 </span>{{ data.status?data.status.name : '-' }}</td>
								<td>{{ data.patientDTO.patientName}}</td>
			          <td>{{ data.patientDTO.residenceNo}}</td>
			          <td>{{ data.takePart}}</td>
			          <td>{{ data.specimenNum}}</td>
			          <td>{{ data.patientDTO.department?data.patientDTO.department.dept : '-'}}</td>
								<td>{{ data.inVitroTime|date:'yyyy-MM-dd HH:mm:ss'  }}</td>
								<td>{{ data.fixationTime|date:'yyyy-MM-dd HH:mm:ss'  }}</td>
								<td>{{ data.deliveryUserDTO?data.deliveryUserDTO.name : '-' }}</td>
								<td>{{ data.leaveDeptTime|date:'yyyy-MM-dd HH:mm:ss'  }}</td>
			          <td>
			            <div class="coop">
										<span (click)="oneLook($event,data)">查看</span>
										<span *ngIf="coopBtns.print && data.printFlag==1" (click)="print('print',data)">补打</span>
			            </div>
			          </td>
			        </tr>
			      </tbody>
			    </nz-table>
			    <div class="list-template__pagination">
			      <nz-pagination [(nzPageIndex)]="pageOneIndex" [(nzTotal)]="listOneLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
			        (nzPageIndexChange)="getConnectList()" (nzPageSizeChange)="getConnectList()">
			      </nz-pagination>
			    </div>
			  </div>
				
				<div class="list-template__bottom" *ngIf="activeIndex==1">
				  <nz-table class="list-template__nzTable" [nzData]="listOneData" nzSize="middle" [nzShowPagination]="false"
				    [nzLoading]="loading1">
				    <thead>
				      <tr class="thead">
								<th 
								*ngIf="coopBtns.batchPrint"
								nzShowCheckbox
								[(nzChecked)]="isAllDisplayDataChecked"
								[nzIndeterminate]="isIndeterminate"
								(nzCheckedChange)="checkAll($event)"></th>
				        <th nzWidth="14%">申请单号</th>
								<th nzWidth="100px">状态</th>
				        <th>患者姓名</th>
				        <th>住院号</th>
				        <th nzWidth="100px">部位</th>
				        <th>标本数</th>
				        <th>申请科室</th>
								<th>离体时间</th>
								<th>固定时间</th>
				        <th>配送人</th>
								<th>配送时间</th>
				        <th nzWidth="120px">操作</th>
				      </tr>
				    </thead>
				    <tbody>
				      <tr *ngFor="let data of listOneData">
								<td
								  *ngIf="coopBtns.batchPrint"
									nzShowCheckbox
									[(nzChecked)]="mapOfCheckedId[data.id]"
									(nzCheckedChange)="refreshStatus()"
								></td>
				        <td><span *ngIf="data.pathologyFormType==1" style="color: red;">速 </span>{{ data.applyCode || '-' }}</td>
				        <td> <span *ngIf="data.deleteFlag==1" class="orange">删 </span>{{ data.status?data.status.name : '-' }}</td>
								<td>{{ data.patientDTO.patientName}}</td>
				        <td>{{ data.patientDTO.residenceNo}}</td>
				        <td>{{ data.takePart}}</td>
				        <td>{{ data.specimenNum}}</td>
				        <td>{{ data.patientDTO.department?data.patientDTO.department.dept : '-'}}</td>
								<td>{{ data.inVitroTime|date:'yyyy-MM-dd HH:mm:ss'  }}</td>
								<td>{{ data.fixationTime|date:'yyyy-MM-dd HH:mm:ss'  }}</td>
								<td>{{ data.deliveryUserDTO?data.deliveryUserDTO.name : '-' }}</td>
								<td>{{ data.leaveDeptTime|date:'yyyy-MM-dd HH:mm:ss'  }}</td>
				        <td>
				          <div class="coop">
										<span (click)="oneLook($event,data)">查看</span>
										<span *ngIf="coopBtns.print" (click)="print('print',data)">打印</span>
				          </div>
				        </td>
				      </tr>
				    </tbody>
				  </nz-table>
				  <div class="list-template__pagination">
				    <nz-pagination [(nzPageIndex)]="pageOneIndex" [(nzTotal)]="listOneLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
				      (nzPageIndexChange)="getConnectList()" (nzPageSizeChange)="getConnectList()">
				    </nz-pagination>
				  </div>
				</div>
			</div>
    </div>
  </div>
</div>

<!-- 科室切换提示框 -->
<app-hs-prompt-modal
  [changeShow]="changeShow"
  [closeTime]="closeTime"
  [closeTimeFlag]="closeTimeFlag"
  [show]="hsPromptModalShow"
  (closeModelHs)="closeModelHs($event)"
  (clearModelHs)="clearModelHs($event)"
> 
  <!-- 返回系统按钮 -->
  <!-- 右侧悬浮框 -->
   <div id="fixedMenu" class="fixed" *ngIf="mainRole">
    <div class="right">
      <div class="fixedMenu hujiaozhongxin">
        <div class="menuItems">
          <div class="item">快捷菜单</div>
        </div>
      </div>
      <div class="fixedMenu">
        <div class="menuItems">
          <div
            class="others"
            [ngStyle]="{
              height: showLastItems
                ? mainRole
                  ? 35 * 2 + 'px'
                  : 35 * 1 + 'px'
                : 0
            }"
          >
            <div
              [ngClass]="{ item: true, checked: fixedTab == 'back' }"
              *ngIf="mainRole"
              (click)="checkFixedTab('toSystem')"
            >
              返回系统
            </div>
          </div>
        </div>
        <div class="arrow" *ngIf="!showLastItems" (click)="fixedMenuXiala()">
          <i class="icon_transport transport-xiala2-01"></i>
        </div>
        <div class="arrow" *ngIf="showLastItems" (click)="fixedMenuShangla()">
          <i class="icon_transport transport-shangla-"></i>
        </div>
      </div>
    </div>
    <div
      *ngIf="showLastItems && fixedTab != ''"
      (click)="fixedMenuShangla()"
      class="fixedMark"
    ></div>
  </div>
</app-hs-prompt-modal>


<!-- 查看详情 -->
<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 border">
			<div class="content-item boder-right">
				<div class="form-title-box">
					<div class="form-title"><span class="font-weight-500">是否术中快速：</span>{{detailsData.pathologyFormType==1?'是':'否'}}</div>
					<div class="form-title"><span class="font-weight-500">申请单编号：</span>{{detailsData.applyCode}}</div>
					<div class="form-title"><span class="font-weight-500">状态：</span>{{detailsData.status.name}}</div>
					<div class="form-title"><span class="font-weight-500">科室名称：</span>{{detailsData.patientDTO.department.dept}}</div>
				</div>
				<div class="form-title-box">
					<div class="form-title"><span class="font-weight-500">住院号：</span>{{detailsData.patientDTO.patientCode}}</div>
					<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>
				
				<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-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 class="form-title"><span class="font-weight-500">部位：</span>{{detailsData.takePart||'无'}}</div>
				</div>
				
				<div class="form-title-box">
					<div class="form-title"><span class="font-weight-500">送检医生：</span>{{detailsData.surgeryDoctorDTO?detailsData.surgeryDoctorDTO.name : '-'}}</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 form-title cursors" (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;">{{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>{{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>

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

<div class="mask-style" *ngIf="isSpinning">
	<nz-spin nzSimple class="spin-style"></nz-spin>
</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]="viewData" 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 viewData">
								<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>

<!-- 打印 -->
<div id="report" style="display: none;">
	<div class="monad">
		<div style="font-size: 12px;">
			<div style="position: relative;height: 100%;" *ngFor="let data of printData; let index=index;">
				<div style="position: relative;width:96%;margin-left: 2%;padding-bottom: 12px;">
					<div style="height: 80px;line-height: 80px;text-align: center;font-size: 30px;">病理申请单</div>
					<div *ngIf="pathologyBarCode==1" style="position: absolute;right: 0;height: 95%;top: 10px;text-align: right;">
					 <img style="max-width: 75%;height: 50%;" [src]="data.barCode" alt="">
					 <div>申请单号:{{data.applyCode}}</div>
					</div>
					<div *ngIf="pathologyBarCode==2" style="position: absolute;right: 10px;height: 95%;top: 0px;text-align: center;">
					 <img style="max-width: 100%;height: 80%;" [src]="data.barCode" alt="">
					 <div>申请单号:{{data.applyCode}}</div>
					</div>
				</div>
				<div style="border-top: 1px solid #333; width:96%;margin-left: 2%;padding-bottom: 12px;">
					<div style="display: flex; justify-content: space-between; margin-top:12px;">
						<div>姓名: {{data.patientDTO ? data.patientDTO.patientName : ''}}</div>
						<div>性别: {{data.patientDTO && data.patientDTO.gender ? data.patientDTO.gender.name:''}}</div>
						<div>年龄: {{data.patientDTO ? data.patientDTO.age : ''}}</div>
						<div>电话: {{data.patientDTO?data.patientDTO.patientPhone:''}}</div>
					</div>
					<div style="display: flex; justify-content: space-between; margin-top:12px;">
						<div>门诊号: {{data.patientDTO.patientCode}}</div>
						<div>住院号: {{data.patientDTO.residenceNo}}</div>
						<div>床号: {{data.patientDTO.bedNum}}</div>
						<div>科室: {{deptName}}</div>
					</div>
					<div style="display: flex; justify-content: space-between; margin-top:12px;">
						<div style="width: 100%;overflow: hidden;">活检部位: {{data.takePart}}</div>
					</div>
					<div style="display: flex; justify-content: space-between; margin-top:12px;">
						<div>检查时间: {{data.createTime|date:'yyyy-MM-dd HH:mm:ss'}}</div>
						<div>离体时间: {{data.inVitroTime|date:'yyyy-MM-dd HH:mm:ss'}}</div>
						<div>固定时间: {{data.fixationTime|date:'yyyy-MM-dd HH:mm:ss'}}</div>
					</div>
				</div>
				<div style="border-top: 1px solid #333; width:96%;margin-left: 2%;padding-bottom: 12px;">
					<div style="margin-top:12px;">临床诊断:</div>
					<div style="margin-top:12px;">{{data.diagnose}}</div>
					<div style="margin-top:12px;">检查所见:</div>
					<div style="margin-top:12px;">
						{{data.intraoperativeFindings}}
					</div>
					<div style="margin-top:12px;">手术诊断:</div>
					<div style="margin-top:12px;">{{data.surgicalPlan}}</div>
					<div style="margin-top:12px;">备注:</div>
				</div>
				<div style="width:96%;margin-left: 2%;padding-bottom: 12px; border-top: 1px solid #333;position: absolute;bottom: 0;">
					<div style="display: flex; margin-top:12px;">
						<div style="flex: 1;">取材医生: {{data.surgeryDoctorDTO?data.surgeryDoctorDTO.name:''}}</div>
						<div style="flex: 1;">取材护士: {{data.nurseDTO?data.nurseDTO.name:''}}</div>
					</div>
					<div style="margin-top:12px;">注意事项:</div>
					<div style="margin-top:12px;">
						1、患者姓名、住院号必须在标本瓶上著名。
					</div>
					<div style="margin-top:12px;">
						2、标本必须立即固定10 %福尔马林液体内，瓶口宜大以便取出。
					</div>
					<div style="margin-top:12px;">
						3、手术取下之标本，务请全部送检，如贵科科研需要，请注明，我科检查后商议处理。
					</div>
					<div style="margin-top:12px;">
						4、如发现检查与临床有意见不符之处，请与我科联系
					</div>
				</div>
			 <div style="height: 26px;" *ngIf="printData && printData.length>1 && index+1 < printData.length"></div>
			</div>
		</div>
</div>