|
@@ -3,6 +3,7 @@ package com.diagbot.model.ai.process;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.diagbot.model.ai.model.EntityEnum;
|
|
import com.diagbot.model.ai.model.EntityEnum;
|
|
|
|
+import com.diagbot.model.ai.model.Lemma;
|
|
import com.diagbot.model.entity.Lis;
|
|
import com.diagbot.model.entity.Lis;
|
|
import com.diagbot.model.entity.LisValue;
|
|
import com.diagbot.model.entity.LisValue;
|
|
import com.diagbot.model.entity.PD;
|
|
import com.diagbot.model.entity.PD;
|
|
@@ -16,6 +17,7 @@ import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
public class EntityProcessLis extends EntityProcess {
|
|
public class EntityProcessLis extends EntityProcess {
|
|
|
|
+
|
|
public List<Lis> extractEntity(JSONObject outputs) {
|
|
public List<Lis> extractEntity(JSONObject outputs) {
|
|
List<Lis> lises = new ArrayList<>();
|
|
List<Lis> lises = new ArrayList<>();
|
|
Lis lis = null;
|
|
Lis lis = null;
|
|
@@ -71,9 +73,61 @@ public class EntityProcessLis extends EntityProcess {
|
|
}
|
|
}
|
|
lises.add(lis);
|
|
lises.add(lis);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 读取实验室检查带结果的化验,将套餐和明细都置成实验室检查名称,主要用来解决套餐和明细同一个名字只写一次的问题
|
|
|
|
+ */
|
|
|
|
+ List<Lemma> lisLemmas = createEntityTree(outputs, EntityEnum.LABORATORY.toString());
|
|
|
|
+ for (Lemma lemma : lisLemmas) {
|
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
|
+ List<Lemma> sonLemma = lemma.getRelationLemmas();
|
|
|
|
+ for (Lemma leSon : sonLemma) {
|
|
|
|
+ if (leSon.getId() > lemma.getId()) {
|
|
|
|
+ if (leSon.getProperty().equals(EntityEnum.LABORATORY_VALUE.toString())) {
|
|
|
|
+ Lis lisBean = new Lis();
|
|
|
|
+ lisBean.setName(lemma.getText());
|
|
|
|
+ lisBean.setBigItem(generateLisValue(lemma.getText())); // 套餐
|
|
|
|
+ lisBean.setLisValue(generateLisValue(leSon.getText())); // 结果
|
|
|
|
+ lisBean.setPd(generatePd(leSon.getText())); // 结果结构化
|
|
|
|
+ lises.add(lisBean);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return lises;
|
|
return lises;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 生成PD实体类型
|
|
|
|
+ *
|
|
|
|
+ * @param value
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public PD generatePd(String value) {
|
|
|
|
+ PD pd = new PD();
|
|
|
|
+ String[] val_unit = new String[2];
|
|
|
|
+ if (value.trim().length() > 0) {
|
|
|
|
+ val_unit = extract_digit_new(value);
|
|
|
|
+ }
|
|
|
|
+ pd.setValue(val_unit[0]);
|
|
|
|
+ pd.setUnit(val_unit[1]);
|
|
|
|
+ return pd;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 生成化验bean类型
|
|
|
|
+ *
|
|
|
|
+ * @param name
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public LisValue generateLisValue(String name) {
|
|
|
|
+ LisValue lisValue = new LisValue();
|
|
|
|
+ lisValue.setName(name);
|
|
|
|
+ return lisValue;
|
|
|
|
+ }
|
|
|
|
+
|
|
private Map<String,List<String>> processLisoutputs(JSONObject outputs){
|
|
private Map<String,List<String>> processLisoutputs(JSONObject outputs){
|
|
JSONObject annotation = outputs.getJSONObject("annotation");
|
|
JSONObject annotation = outputs.getJSONObject("annotation");
|
|
JSONArray entitys = annotation.getJSONArray("T");
|
|
JSONArray entitys = annotation.getJSONArray("T");
|