|
@@ -12,6 +12,8 @@ import java.util.ArrayList;
|
|
|
import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
public class EntityProcessVital extends EntityProcess {
|
|
|
public VitalLabel extractEntity(JSONObject outputs) {
|
|
@@ -108,4 +110,98 @@ public class EntityProcessVital extends EntityProcess {
|
|
|
}
|
|
|
return vitalLabel;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 只获取体征内容
|
|
|
+ * @param outputs
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Vital> extractEntityClinic(JSONObject outputs) {
|
|
|
+ List<Vital> vitals = new ArrayList<>();
|
|
|
+ Vital vital =null;
|
|
|
+ List<Map<String, String>> vitalEntityList = processJson(outputs, EntityEnum.SIGN.toString());
|
|
|
+ for (Map<String, String> vitalEntityMap : vitalEntityList) {
|
|
|
+ if (StringUtils.isEmpty(vitalEntityMap.get(EntityEnum.SIGN.toString()))) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ vital = new Vital();
|
|
|
+ for (String key:vitalEntityMap.keySet()) {
|
|
|
+ String entity = vitalEntityMap.get(key);
|
|
|
+ switch (EntityEnum.parseOfValue(key)) {
|
|
|
+ case SIGN:
|
|
|
+ vital.setName(entity);
|
|
|
+ vital.setStandName(entity);
|
|
|
+ break;
|
|
|
+ case NEGATIVE:
|
|
|
+ Negative negative = new Negative();
|
|
|
+ negative.setName(entity);
|
|
|
+ vital.setNegative(negative);
|
|
|
+ break;
|
|
|
+ case BODY:
|
|
|
+ BodyPart bodyPart = new BodyPart();
|
|
|
+ bodyPart.setName(entity);
|
|
|
+ vital.setBodyPart(bodyPart);
|
|
|
+ break;
|
|
|
+ case INDEX_VALUE:
|
|
|
+ PD pd = new PD();
|
|
|
+ String[] val_unit = new String[2];
|
|
|
+ if (StringUtil.isNotBlank(entity)) {
|
|
|
+ val_unit = extract_digit_new(entity);
|
|
|
+ pd.setValue(val_unit[0]);
|
|
|
+ pd.setUnit(val_unit[1]);
|
|
|
+ }
|
|
|
+ pd.setName(entity);
|
|
|
+ vital.setPd(pd);
|
|
|
+ break;
|
|
|
+ case MODIFICATION:
|
|
|
+ if(entity.contains("度")){
|
|
|
+ Degree degree = new Degree();
|
|
|
+ degree.setName(entity);
|
|
|
+ vital.setDegree(degree);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ vitals.add(vital);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生命体征特殊处理
|
|
|
+ for (Vital vi : vitals) {
|
|
|
+ if ("T".equals(vi.getName().toUpperCase())) {
|
|
|
+ vi.setStandName("体温");
|
|
|
+ } else if ("P".equals(vi.getName().toUpperCase())) {
|
|
|
+ vi.setStandName("脉搏");
|
|
|
+ } else if ("R".equals(vi.getName().toUpperCase())) {
|
|
|
+ vi.setStandName("呼吸");
|
|
|
+ } else if ("血压".equals(vi.getName()) || "BP".equals(vi.getName().toUpperCase())) {
|
|
|
+ String bpName = vi.getPd().getName();
|
|
|
+ Pattern pattern = Pattern.compile("\\d+/\\d+"); // 示例:血压80/44mmHg
|
|
|
+ Matcher matcher = pattern.matcher(bpName);
|
|
|
+
|
|
|
+ if (matcher.find()) {
|
|
|
+ String val = matcher.group();
|
|
|
+ vi.getPd().setValue(val); // 重新赋值血压的数值
|
|
|
+ vi.getPd().setUnit(bpName.substring(bpName.indexOf(val) + 1)); // 重新赋值血压的单位
|
|
|
+
|
|
|
+ String[] bp = val.split("/");
|
|
|
+
|
|
|
+ List<Usual> usualList = new ArrayList<>();
|
|
|
+ Usual usualSbp = new Usual();
|
|
|
+ usualSbp.setName(vi.getName());
|
|
|
+ usualSbp.setStandName("收缩压");
|
|
|
+ usualSbp.setValue(bp[0]);
|
|
|
+ usualList.add(usualSbp);
|
|
|
+ vi.setUsualList(usualList);
|
|
|
+
|
|
|
+ Usual usualDbp = new Usual();
|
|
|
+ usualDbp.setName(vi.getName());
|
|
|
+ usualDbp.setStandName("舒张压");
|
|
|
+ usualDbp.setValue(bp[1]);
|
|
|
+ usualList.add(usualDbp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return vitals;
|
|
|
+ }
|
|
|
}
|