|
@ -3,12 +3,8 @@ 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 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;
|
|
@ -23,7 +19,7 @@ public class ConsultLogTransform implements ILogTransform {
|
|
|
private final BusinessTypeEnum logType = BusinessTypeEnum.consult;
|
|
|
|
|
|
@Override
|
|
|
public List<UserPortrait> transform(JSONObject log) throws UnsupportedEncodingException {
|
|
|
public List<UserPortrait> transform(JSONObject log) {
|
|
|
JSONObject logData = log.getJSONObject("data");
|
|
|
JSONObject businessData = logData.getJSONObject("data");
|
|
|
List<UserPortrait> labelInfoList = new ArrayList<>();
|
|
@ -43,57 +39,52 @@ public class ConsultLogTransform implements ILogTransform {
|
|
|
return logType.name();
|
|
|
}
|
|
|
|
|
|
public List<UserPortrait> transformGxyTnbMb(JSONObject log) throws UnsupportedEncodingException {
|
|
|
/**
|
|
|
* 慢病分析
|
|
|
*
|
|
|
* @param log
|
|
|
* @return
|
|
|
*/
|
|
|
public List<UserPortrait> transformGxyTnbMb(JSONObject log) {
|
|
|
String symptoms = log.getString("symptoms");
|
|
|
Result fc = ToAnalysis.parse(symptoms);
|
|
|
List<String> wordList = new ArrayList<>();
|
|
|
List<UserPortrait> UserPortraits = new ArrayList<>();
|
|
|
List<UserPortrait> userPortraits = new ArrayList<>();
|
|
|
|
|
|
for(Term term : fc.getTerms()) {
|
|
|
wordList.add(term.getName());
|
|
|
}
|
|
|
|
|
|
if(wordList.contains("糖尿病")) {
|
|
|
if(symptoms.contains("糖尿病")) {
|
|
|
UserPortrait labelInfo = new UserPortrait();
|
|
|
|
|
|
labelInfo.setUserCode(log.getString("patient"));
|
|
|
labelInfo.setLabelType(1);
|
|
|
labelInfo.setLabelName("基础特征");
|
|
|
labelInfo.setSubType(3);
|
|
|
labelInfo.setSubName("疾病");
|
|
|
labelInfo.setCategory("1002");
|
|
|
labelInfo.setSubCategory("1002001");
|
|
|
labelInfo.setValue("糖尿病");
|
|
|
labelInfo.setCzrq(new Date());
|
|
|
|
|
|
UserPortraits.add(labelInfo);
|
|
|
userPortraits.add(labelInfo);
|
|
|
}
|
|
|
|
|
|
if(wordList.contains("高血压")) {
|
|
|
if(symptoms.contains("高血压")) {
|
|
|
UserPortrait labelInfo = new UserPortrait();
|
|
|
|
|
|
labelInfo.setUserCode(log.getString("patient"));
|
|
|
labelInfo.setLabelType(1);
|
|
|
labelInfo.setLabelName("基础特征");
|
|
|
labelInfo.setSubType(3);
|
|
|
labelInfo.setSubName("疾病");
|
|
|
labelInfo.setCategory("1002");
|
|
|
labelInfo.setSubCategory("1002001");
|
|
|
labelInfo.setValue("高血压");
|
|
|
labelInfo.setCzrq(new Date());
|
|
|
UserPortraits.add(labelInfo);
|
|
|
|
|
|
userPortraits.add(labelInfo);
|
|
|
}
|
|
|
|
|
|
if(wordList.contains("慢病")) {
|
|
|
if(symptoms.contains("慢病")) {
|
|
|
UserPortrait labelInfo = new UserPortrait();
|
|
|
|
|
|
labelInfo.setUserCode(log.getString("patient"));
|
|
|
labelInfo.setLabelType(1);
|
|
|
labelInfo.setLabelName("基础特征");
|
|
|
labelInfo.setSubType(3);
|
|
|
labelInfo.setSubName("疾病");
|
|
|
labelInfo.setValue("慢病");
|
|
|
labelInfo.setCategory("1002");
|
|
|
labelInfo.setSubCategory("1002001");
|
|
|
labelInfo.setValue("慢病人群");
|
|
|
labelInfo.setCzrq(new Date());
|
|
|
|
|
|
UserPortraits.add(labelInfo);
|
|
|
userPortraits.add(labelInfo);
|
|
|
}
|
|
|
|
|
|
return UserPortraits;
|
|
|
return userPortraits;
|
|
|
}
|
|
|
}
|