|
@@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.lantone.qc.kernel.structure.ai.model.CrfOut;
|
|
import com.lantone.qc.kernel.structure.ai.model.CrfOut;
|
|
import com.lantone.qc.kernel.structure.ai.model.EntityEnum;
|
|
import com.lantone.qc.kernel.structure.ai.model.EntityEnum;
|
|
import com.lantone.qc.pub.model.entity.Negative;
|
|
import com.lantone.qc.pub.model.entity.Negative;
|
|
|
|
+import com.lantone.qc.pub.model.entity.Operation;
|
|
import com.lantone.qc.pub.model.entity.Past;
|
|
import com.lantone.qc.pub.model.entity.Past;
|
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -19,12 +21,13 @@ public class EntityProcessPast extends EntityProcess {
|
|
public static String blood_history = "输血史";
|
|
public static String blood_history = "输血史";
|
|
public static String vaccination_history = "预防接种史";
|
|
public static String vaccination_history = "预防接种史";
|
|
public static String infect_history = "传染病史";
|
|
public static String infect_history = "传染病史";
|
|
- @Override
|
|
|
|
|
|
+
|
|
public void extractEntity(JSONObject outputs, CrfOut outputInfo) {
|
|
public void extractEntity(JSONObject outputs, CrfOut outputInfo) {
|
|
List<Past> pasts = new ArrayList<>();
|
|
List<Past> pasts = new ArrayList<>();
|
|
//疾病史
|
|
//疾病史
|
|
addPast(outputs, pasts);
|
|
addPast(outputs, pasts);
|
|
//手术史
|
|
//手术史
|
|
|
|
+ addPast(outputs, EntityEnum.OPERATION, Operation.class);
|
|
addPast(outputs, pasts, EntityEnum.OPERATION, 1, EntityProcessPast.surgery_history);
|
|
addPast(outputs, pasts, EntityEnum.OPERATION, 1, EntityProcessPast.surgery_history);
|
|
addPast(outputs, pasts, EntityEnum.OPERATION_KEYWORD, 1, EntityProcessPast.surgery_history);
|
|
addPast(outputs, pasts, EntityEnum.OPERATION_KEYWORD, 1, EntityProcessPast.surgery_history);
|
|
|
|
|
|
@@ -96,26 +99,4 @@ public class EntityProcessPast extends EntityProcess {
|
|
pasts.add(past);
|
|
pasts.add(past);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- private void addPast(JSONObject outputs, List<Past> pasts, EntityEnum entityType, int pastType, String pastTypeString) {
|
|
|
|
- Past past = null;
|
|
|
|
- List<Map<String, String>> pastEntityList = processJson(outputs, entityType.toString());
|
|
|
|
- for (Map<String, String> pastEntityMap : pastEntityList) {
|
|
|
|
- if (StringUtils.isEmpty(pastEntityMap.get(entityType.toString()))) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- past = new Past();
|
|
|
|
- for (String key : pastEntityMap.keySet()) {
|
|
|
|
- if (key.equals(entityType.toString())) {
|
|
|
|
- past.setType(pastType);
|
|
|
|
- past.setTitle(pastTypeString);
|
|
|
|
- past.setValue(pastEntityMap.get(key));
|
|
|
|
- } else if (key.equals(EntityEnum.NEGATIVE.toString())) {
|
|
|
|
- Negative negative = new Negative();
|
|
|
|
- negative.setName(StringUtils.isEmpty(pastEntityMap.get(key)) ? "" : pastEntityMap.get(key));
|
|
|
|
- past.setNegative(negative);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- pasts.add(past);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|