| 
					
				 | 
			
			
				@ -11,6 +11,7 @@ import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.util.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * CDA相关接口服务 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -557,4 +558,280 @@ public class ProfileCDAService extends ProfileBasicService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *  获取检验/检查细表数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param profileId 细表rowkey 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param transform 是否转换标准 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param mark 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String, Object> getInspectionPartData(String profileId, boolean transform, String mark) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //标准包档案的主键以机构编码开头 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> result = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String[] cdaDocumentIdList = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (profileId.split("_")[0].length() > 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            final boolean is_multi = profileId.contains("$") ? true : false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Envelop envelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (is_multi) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                envelop = resource.getMasterData("{\"q\":\"rowkey:" + profileId.split("\\$")[0] + "\"}", 1, 1, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                envelop = resource.getMasterData("{\"q\":\"rowkey:" + profileId + "\"}", 1, 1, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> eventList = envelop.getDetailModelList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (eventList != null && eventList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Map<String, Object> event = eventList.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String cdaVersion = String.valueOf(event.get(ResourceCells.CDA_VERSION)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //获取cda document数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] docName = {"检查报告","检验报告"}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<ArchiveTemplate> archiveTemplates = archiveTemplateService.findByCdaDocumenName(cdaVersion,Arrays.asList(docName)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //cda documentId数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<String> cdaList = archiveTemplates.stream().map(ArchiveTemplate::getCdaDocumentId).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                cdaDocumentIdList = cdaList.toArray(new String[cdaList.size()]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Map<String, Object> dataMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Map<String, List<MCdaDataSet>> cdaDataSetMap = cdaService.getCDADataSetByCDAIdList(cdaVersion, cdaDocumentIdList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (transform) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    cdaDataSetMap.keySet().forEach(cdaDocId -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        List<MCdaDataSet> cdaDataSets = cdaDataSetMap.get(cdaDocId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        Map<String, Object> tempMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        List<String> multipleDataset = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (cdaDataSets != null && cdaDataSets.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            cdaDataSets.forEach(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                String dataSetCode = item.getDataSetCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if (item.getMultiRecord().equals("0")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    //主表数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    if (!tempMap.containsKey(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        List<Map<String, Object>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        tempList.add(resourcesTransformService.stdTransform(event, dataSetCode, cdaVersion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        tempMap.put(dataSetCode, tempList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    multipleDataset.add(dataSetCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        //细表数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (is_multi) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            String[] combination = profileId.split("\\$"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            String subQ = "{\"q\":\"profile_id:" + combination[0] + "\"}"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            StringBuilder subQuery = new StringBuilder("{\"q\":\"profile_id:" + combination[0] + " AND ("); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            for (int i=0;i<multipleDataset.size();i++ ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if (i==multipleDataset.size()-1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    subQuery.append("rowkey:").append(combination[0]).append("$").append(multipleDataset.get(i)).append("$*"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    subQuery.append("rowkey:").append(combination[0]).append("$").append(multipleDataset.get(i)).append("$*").append(" OR "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            subQuery.append( ")\"}"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            Envelop subData = resource.getSubData(subQuery.toString(), 1, 2000, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            List<Map<String, Object>> subList = subData.getDetailModelList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            subList.forEach(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                item.put(ResourceCells.ORG_AREA, event.get(ResourceCells.ORG_AREA)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                item.put(ResourceCells.ORG_NAME, event.get(ResourceCells.ORG_NAME)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                item.put(ResourceCells.EVENT_DATE, event.get(ResourceCells.EVENT_DATE)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                String dataSetCode = String.valueOf(item.get(ResourceCells.ROWKEY)).split("\\$")[1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if (combination[1].equals(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    if (profileId.equals(item.get(ResourceCells.ROWKEY))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        if (tempMap.containsKey(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            List<Map<String, Object>> tempList = (List<Map<String, Object>>) tempMap.get(dataSetCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            tempList.add(resourcesTransformService.stdTransform(item, dataSetCode, cdaVersion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            List<Map<String, Object>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            tempList.add(resourcesTransformService.stdTransform(item, dataSetCode, cdaVersion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            tempMap.put(dataSetCode, tempList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                if (combination[1].equals("HDSD00_79") && dataSetCode.equals("HDSD00_78") && !StringUtils.isEmpty(mark)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    if (mark.equals(item.get("EHR_006291"))) { //报告单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        if (tempMap.containsKey(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            List<Map<String, Object>> tempList = (List<Map<String, Object>>) tempMap.get(dataSetCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempList.add(resourcesTransformService.stdTransform(item, dataSetCode, cdaVersion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            List<Map<String, Object>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempList.add(resourcesTransformService.stdTransform(item, dataSetCode, cdaVersion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempMap.put(dataSetCode, tempList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                if (combination[1].equals("HDSD00_77") && dataSetCode.equals("HDSD00_76") && !StringUtils.isEmpty(mark)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    if (mark.equals(item.get("EHR_006294"))) { //报告单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        if (tempMap.containsKey(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            List<Map<String, Object>> tempList = (List<Map<String, Object>>) tempMap.get(dataSetCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempList.add(resourcesTransformService.stdTransform(item, dataSetCode, cdaVersion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            List<Map<String, Object>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempList.add(resourcesTransformService.stdTransform(item, dataSetCode, cdaVersion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempMap.put(dataSetCode, tempList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                if (combination[1].equals("HDSD00_77") && dataSetCode.equals("HDSD00_75") && !StringUtils.isEmpty(mark)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    if (mark.equals(item.get("EHR_006339"))) { //报告单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        if (tempMap.containsKey(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            List<Map<String, Object>> tempList = (List<Map<String, Object>>) tempMap.get(dataSetCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempList.add(resourcesTransformService.stdTransform(item, dataSetCode, cdaVersion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            List<Map<String, Object>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempList.add(resourcesTransformService.stdTransform(item, dataSetCode, cdaVersion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempMap.put(dataSetCode, tempList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if (tempMap.containsKey(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    List<Map<String, Object>> tempList = (List<Map<String, Object>>) tempMap.get(dataSetCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    tempList.add(resourcesTransformService.stdTransform(item, dataSetCode, cdaVersion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    List<Map<String, Object>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    tempList.add(resourcesTransformService.stdTransform(item, dataSetCode, cdaVersion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    tempMap.put(dataSetCode, tempList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            multipleDataset.forEach(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if (!tempMap.containsKey(item)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    tempMap.put(item, new ArrayList<>()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            dataMap.put(cdaDocId, tempMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    cdaDataSetMap.keySet().forEach(cdaDocId -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        List<MCdaDataSet> cdaDataSets = cdaDataSetMap.get(cdaDocId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        Map<String, Object> tempMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        List<String> multipleDataset = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (cdaDataSets != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            cdaDataSets.forEach(cdaDataSet -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                String dataSetCode = cdaDataSet.getDataSetCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if (cdaDataSet.getMultiRecord().equals("0")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    //主表数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    if (!tempMap.containsKey(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        List<Map<String, Object>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        tempList.add(resourcesTransformService.stdMerge(event, dataSetCode, cdaVersion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        tempMap.put(dataSetCode, tempList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    multipleDataset.add(dataSetCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        //细表数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (is_multi) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            String[] combination = profileId.split("\\$"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            String subQ = "{\"q\":\"profile_id:" + combination[0] + "\"}"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            Envelop subData = resource.getSubData(subQ, 1, 2000, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            List<Map<String, Object>> subList = subData.getDetailModelList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            subList.forEach(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                item.put(ResourceCells.ORG_AREA, event.get(ResourceCells.ORG_AREA)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                item.put(ResourceCells.ORG_NAME, event.get(ResourceCells.ORG_NAME)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                item.put(ResourceCells.EVENT_DATE, event.get(ResourceCells.EVENT_DATE)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                String dataSetCode = String.valueOf(item.get(ResourceCells.ROWKEY)).split("\\$")[1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if (combination[1].equals(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    if (profileId.equals(item.get(ResourceCells.ROWKEY))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        if (tempMap.containsKey(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            List<Map<String, Object>> tempList = (List<Map<String, Object>>) tempMap.get(dataSetCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            tempList.add(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            List<Map<String, Object>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            tempList.add(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            tempMap.put(dataSetCode, tempList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                if (combination[1].equals("HDSD00_79") && dataSetCode.equals("HDSD00_78") && !StringUtils.isEmpty(mark)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    if (mark.equals(item.get("EHR_006291"))) { //报告单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        if (tempMap.containsKey(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            List<Map<String, Object>> tempList = (List<Map<String, Object>>) tempMap.get(dataSetCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempList.add(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            List<Map<String, Object>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempList.add(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempMap.put(dataSetCode, tempList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                if (combination[1].equals("HDSD00_77") && dataSetCode.equals("HDSD00_76") && !StringUtils.isEmpty(mark)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    if (mark.equals(item.get("EHR_006294"))) { //报告单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        if (tempMap.containsKey(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            List<Map<String, Object>> tempList = (List<Map<String, Object>>) tempMap.get(dataSetCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempList.add(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            List<Map<String, Object>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempList.add(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempMap.put(dataSetCode, tempList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                if (combination[1].equals("HDSD00_77") && dataSetCode.equals("HDSD00_75") && !StringUtils.isEmpty(mark)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    if (mark.equals(item.get("EHR_006339"))) { //报告单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        if (tempMap.containsKey(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            List<Map<String, Object>> tempList = (List<Map<String, Object>>) tempMap.get(dataSetCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempList.add(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            List<Map<String, Object>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempList.add(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                            tempMap.put(dataSetCode, tempList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if (tempMap.containsKey(dataSetCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    List<Map<String, Object>> tempList = (List<Map<String, Object>>) tempMap.get(dataSetCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    tempList.add(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    List<Map<String, Object>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    tempList.add(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    tempMap.put(dataSetCode, tempList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            multipleDataset.forEach(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if (!tempMap.containsKey(item)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    tempMap.put(item, new ArrayList<>()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            dataMap.put(cdaDocId, tempMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                archiveTemplates.forEach(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Map<String, Object> temp = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    temp.put("cda_version", cdaVersion); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    temp.put("cda_document_id", item.getCdaDocumentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    temp.put("cda_document_name", item.getCdaDocumentName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    temp.put("data_sets", dataMap.get(item.getCdaDocumentId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    temp.put("event_type", event.get("event_type")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    temp.put("patient_id", event.get("patient_id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    temp.put("org_code", event.get("org_code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    temp.put("org_name", event.get("org_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    temp.put("event_no", event.get("event_no")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    temp.put("event_date", event.get("event_date")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(item.getCdaDocumentId(), temp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Envelop envelop = resource.healthFile("_id=" + profileId, null, 1, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> dataList = envelop.getDetailModelList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (dataList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Map<String, Object> event = dataList.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put(cdaDocumentIdList[0], event); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |