| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -443,7 +443,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        List<EntrustmentIdentificationMaterial> materialList = entrustmentIdentificationMaterialService.list(Wrappers.<EntrustmentIdentificationMaterial>lambdaQuery() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                .eq(EntrustmentIdentificationMaterial::getEntrustmentId, entrustId) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                .orderByAsc(isAccepted != -1, EntrustmentIdentificationMaterial::getAcceptNo) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                .orderByAsc(isAccepted == -1, EntrustmentIdentificationMaterial::getImNo)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                .orderByAsc(isAccepted == -1, EntrustmentIdentificationMaterial::getOrderNo)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        if (isAccepted != -1) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            // 受理过的才进行排序,否则采用检材编号排序
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            Collections.sort(materialList, new Comparator<EntrustmentIdentificationMaterial>() { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -497,7 +497,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        //构造委托部分需要的数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        dm.put("clientOrgName", entrustment.getClientOrgName());//委托单位
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        dm.put("identificationNo", entrustment.getAcceptNo());//受理编号
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        dm.put("year", entrustment.getEntrustmentTime().getYear()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        dm.put("year", entrustment.getEntrustmentTime() != null ? entrustment.getEntrustmentTime().getYear() : LocalDate.now().getYear()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        dm.put("materialDes", buildMaterialDes(materialList));//检材描述
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        dm.put("identifyReq", entrustment.getEntrustRequirement());//鉴定要求
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -688,7 +688,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        eg.setAcceptNo(item.getAcceptNo()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        eg.setIndexNo(item.getShortNameDes() + "检材"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        eg.setMaterialName(item.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        eg.setFormName(StringUtils.isNotBlank(item.getColor()) ? item.getColor() + item.getFormName() : "" + item.getFormName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        // 先暂时去掉这个功能,他们可能
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        //eg.setFormName(StringUtils.isNotBlank(item.getColor()) ? item.getColor() + item.getFormName() : "" + item.getFormName());
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        eg.setFormName(item.getFormName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        eg.setSpecies(item.getTypeName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        eg.setPackComplete(item.getPackComplete()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        eg.setDrugsValue(item.getDrugsValue()); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -1893,7 +1895,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        if (entrustment.getStatus() != EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CONFIRM.getStatus()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            throw new RuntimeException("委托不在待送检确认状态"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            return null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        if (!dlpUser.isStaff()) { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -2117,7 +2119,8 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        // 转换临时目录中的 word 文档为 PDF
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        String pdfFilePath = OSSDirectoryConstants.DOCUMENT_ENTRUSTMENT_DIRECTORY + "/" + ev.getId() + "/" + entrustmentLetterFileName + ".docx"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            if (!ossFile.objectExist(pdfFilePath)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            //这里加一下判断条件,由于贵阳市局这里的情况是审核的时候就需要查看委托书,所以为了保证每一次提交过来的委托都是最新的,所以在审核通过以前应该每次查看都是重新生成
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            if (!ossFile.objectExist(pdfFilePath) || ev.getStatus() < EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CONFIRM.getStatus()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                GenerateEntrustmentLetterPDF(ev); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                return pdfFilePath; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            } | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -2144,8 +2147,8 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            throw new RuntimeException(String.format("没有找到 id 为 %s 的委托", id)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        if (ev.getStatus() < EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_DELIVER.getStatus()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            throw new RuntimeException("委托状态必须在[待送检]及之后才能打印鉴定委托书"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        if (ev.getStatus() < EntrustmentStatusConstants.ENTRUSTMENT_STATUS_CREATED.getStatus()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            throw new RuntimeException("委托状态必须在委托创建之后才能打印鉴定委托书"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        if (!dlpUser.isStaff()) { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -2213,7 +2216,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        List<EntrustmentIdentificationMaterial> materialList = entrustmentIdentificationMaterialService.list( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                Wrappers.<EntrustmentIdentificationMaterial>query() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                        .eq("entrustment_id", ev.getId()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                        .orderByAsc("create_time") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                        .orderByAsc("order_no") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        ); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        entrustmentIdentificationMaterialService.conformityDrugs(materialList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        //设置检材描述
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -2624,9 +2627,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        // 正在受理和已受理这2个状态下可以打印
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        if (ev.getStatus() != EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_ACCEPT.getStatus() && | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                ev.getStatus() != EntrustmentStatusConstants.ENTRUSTMENT_STATUS_ACCEPTED.getStatus()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            throw new RuntimeException("委托不在[受理中]或[已受理]状态"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        //这里再次修改一下,以前是待受理和已受理两个状态才能生成,由于贵阳市局这里的情况是需要在审核的时候查看确认书,所以如果状态是在委托提交以前我们才不允许生成
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        if (ev.getStatus() < EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CHECK_CLAIM.getStatus()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            throw new RuntimeException("委托不在可以生成确认书的状态"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        // if (!StrUtil.equalsIgnoreCase(ev.getClientOrgId(), dlpUser.getOrgId())) {
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				 | 
				
					@ -2647,7 +2650,8 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            //如果文件不存在,则生成,否则直接从OSS中获取
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            //if (!ossFile.objectExist(pdfFilePath)) {
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            if (!ossFile.objectExist(downFile)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            //这里加一个判断,由于贵阳市局的确认书需要在审核的时候就能打印出来,为了保证每一次生成的确认书都是委托单位提交过来的最新版,所以我们在审核通过之前,每一次生成委托书都应该重新生成,审核成功以后就不用再重新生成了
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					            if (!ossFile.objectExist(downFile) || ev.getStatus() < EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CONFIRM.getStatus()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                if (this.generateIdentifyItemsBook(ev.getId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                    ossFile.fileGet(downFile, httpServletResponse.getOutputStream()); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				 | 
				
					
  |