| 
					
				 | 
			
			
				@ -3,8 +3,14 @@ package com.yihu.wlyy.analysis.etl.transform; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.analysis.entity.UserPortrait; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.analysis.etl.BusinessTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.analysis.etl.ILogTransform; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import net.sf.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.ansj.domain.Result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.ansj.domain.Term; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.ansj.splitWord.analysis.ToAnalysis; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.io.UnsupportedEncodingException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -17,8 +23,14 @@ public class ConsultLogTransform implements ILogTransform { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private final BusinessTypeEnum logType = BusinessTypeEnum.consult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<UserPortrait> transform(JSONObject log) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<UserPortrait> transform(JSONObject log) throws UnsupportedEncodingException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject logData = log.getJSONObject("data"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject businessData = logData.getJSONObject("data"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<UserPortrait> labelInfoList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 慢病分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        labelInfoList.addAll(transformGxyTnbMb(businessData)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return labelInfoList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Override 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -30,4 +42,58 @@ public class ConsultLogTransform implements ILogTransform { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getLogTypeName() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return logType.name(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<UserPortrait> transformGxyTnbMb(JSONObject log) throws UnsupportedEncodingException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String symptoms = log.getString("symptoms"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Result fc = ToAnalysis.parse(symptoms); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<String> wordList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<UserPortrait> UserPortraits = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Term term : fc.getTerms()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wordList.add(term.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(wordList.contains("糖尿病")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            UserPortrait labelInfo = new UserPortrait(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setUserCode(log.getString("patient")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setLabelType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setLabelName("基础特征"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setSubType(3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setSubName("疾病"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setValue("糖尿病"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setCzrq(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            UserPortraits.add(labelInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(wordList.contains("高血压")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            UserPortrait labelInfo = new UserPortrait(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setUserCode(log.getString("patient")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setLabelType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setLabelName("基础特征"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setSubType(3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setSubName("疾病"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setValue("高血压"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setCzrq(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            UserPortraits.add(labelInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(wordList.contains("慢病")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            UserPortrait labelInfo = new UserPortrait(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setUserCode(log.getString("patient")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setLabelType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setLabelName("基础特征"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setSubType(3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setSubName("疾病"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setValue("慢病"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelInfo.setCzrq(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            UserPortraits.add(labelInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return UserPortraits; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |