|
@@ -16,6 +16,7 @@ import org.apache.commons.lang3.time.DateUtils;
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Description:入院记录
|
|
@@ -121,6 +122,59 @@ public class BeHospitalizedTran extends TargetTran {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(retMap.get("个人史"))){
|
|
|
+ List<String> titles = Arrays.asList("半文盲","文盲","小学","初中","高中","技工学校","中等技术学校","中技","中等专业学校","中专","专科学校","大专","大学","专科","本科","研究生","博士","博士后");
|
|
|
+ String personHistory = retMap.get("个人史").replace("未受过教育","文盲");
|
|
|
+ for (String title : titles) {
|
|
|
+ if(personHistory.contains(title)){
|
|
|
+ retMap.put("学历",title);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ personHistory = personHistory.replace("每日", "每天").replace("/", "/").replace("/天", "/日").replace("。", ",").replace(",", ",").replace("抽烟", "吸烟").replace("平均", "").replace("大概", "").replace("估计", "").replace("差不多", "").replace("每日约", "").replace("半", "0.5").replace("一", "1").replace("二", "2").replace("三", "3");
|
|
|
+ String flagSmoke = "每天吸烟";
|
|
|
+ if(!personHistory.contains("/日")){
|
|
|
+ if(!personHistory.contains(flagSmoke) && personHistory.contains("每天")){
|
|
|
+ personHistory = personHistory.replace("每天","每天吸烟");
|
|
|
+ }
|
|
|
+ String flag = "支";
|
|
|
+ if(personHistory.contains("包")){
|
|
|
+ flag = "包";
|
|
|
+ }
|
|
|
+ if(personHistory.contains(flag)){
|
|
|
+ personHistory = personHistory.substring(personHistory.indexOf("每天吸烟")+"每天".length(),personHistory.indexOf(flag)+flag.length())+"/日";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!personHistory.contains("否认吸烟") && personHistory.contains("吸烟") && personHistory.contains("/日")){
|
|
|
+ personHistory = smokeMethod(personHistory).replace("吸烟","");
|
|
|
+ personHistory = personHistory.substring(personHistory.lastIndexOf(",")+",".length());
|
|
|
+ if(personHistory.contains("包")){
|
|
|
+ List<Double> smokeNum = new ArrayList<>();
|
|
|
+ String personHistorySec = personHistory.replace("包","").replace("~","-").replace("~","-").replace("—","-").replace("到","-").replace("至","-");
|
|
|
+ try {
|
|
|
+ if(personHistorySec.contains("-")){
|
|
|
+ for (String str : personHistorySec.split("-")) {
|
|
|
+ smokeNum.add(Double.valueOf(str));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ smokeNum.add(Double.valueOf(personHistorySec));
|
|
|
+ }
|
|
|
+ if(ListUtil.isNotEmpty(smokeNum)){
|
|
|
+ Double collect = smokeNum.stream().collect(Collectors.averagingDouble(obj -> obj));
|
|
|
+ personHistory = (int)Math.ceil(collect * 20)+"";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (NumberFormatException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ personHistory = personHistorySec + "包";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ retMap.put("日吸烟量(支)",personHistory);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//病史陈述者
|
|
|
if(StringUtil.isNotEmpty(retMap.get("病史陈述者"))){
|
|
|
String casePerson = retMap.get("病史陈述者");
|
|
@@ -230,21 +284,25 @@ public class BeHospitalizedTran extends TargetTran {
|
|
|
|
|
|
|
|
|
if(split.contains("T") && split.contains("℃") ){
|
|
|
- String t = split.substring(split.indexOf("T")+"T".length(),split.indexOf("℃")+"℃".length());
|
|
|
+ String t = split.substring(split.indexOf("T")+"T".length(),split.indexOf("℃")+"℃".length()).replace("体温","");
|
|
|
split = split.substring(split.indexOf(t)+t.length());
|
|
|
if(StringUtil.isNotEmpty(t)){
|
|
|
retMap.put("体格检查--体温(℃)", t);
|
|
|
}
|
|
|
}
|
|
|
if(split.contains("P") && split.contains("分")){
|
|
|
- String p = split.substring(split.indexOf("P")+"P".length(),split.indexOf("分")+"分".length());
|
|
|
+ String p = split.substring(0,split.indexOf("分")+"分".length());
|
|
|
+ if(!p.contains("P") && p.contains("脉搏")){
|
|
|
+ p = p.replace("脉搏","P");
|
|
|
+ }
|
|
|
+ p = p.substring(p.indexOf("P")+"P".length());
|
|
|
split = split.substring(split.indexOf(p)+p.length());
|
|
|
if(StringUtil.isNotEmpty(p)){
|
|
|
retMap.put("体格检查--脉率(次/min)", p);
|
|
|
}
|
|
|
}
|
|
|
if(split.contains("R") && split.contains("分")){
|
|
|
- String r = split.substring(split.indexOf("R")+"R".length(),split.indexOf("分")+"分".length());
|
|
|
+ String r = split.substring(split.indexOf("R")+"R".length(),split.indexOf("分")+"分".length()).replace("呼吸","");
|
|
|
split = split.substring(split.indexOf(r)+r.length());
|
|
|
if(StringUtil.isNotEmpty(r)){
|
|
|
retMap.put("体格检查--呼吸频率(次/min)", r);
|
|
@@ -259,8 +317,8 @@ public class BeHospitalizedTran extends TargetTran {
|
|
|
if(split.contains("/")){
|
|
|
flag = "/";
|
|
|
}
|
|
|
- String b = split.substring(split.indexOf(bp)+bp.length(),split.indexOf(flag));
|
|
|
- String p = split.substring(split.indexOf(flag)+flag.length(),split.lastIndexOf("mmHg")+"mmHg".length());
|
|
|
+ String b = split.substring(split.indexOf(bp)+bp.length(),split.indexOf(flag)).replace("血压","");
|
|
|
+ String p = split.substring(split.indexOf(flag)+flag.length(),split.lastIndexOf("mmHg")+"mmHg".length()).replace("血压","");;
|
|
|
if(StringUtil.isNotEmpty(b)){
|
|
|
retMap.put("体格检查--收缩压(mmHg)", b+"mmHg");
|
|
|
}
|
|
@@ -398,8 +456,10 @@ public class BeHospitalizedTran extends TargetTran {
|
|
|
retMap.put("专科情况",retStr);
|
|
|
}
|
|
|
}
|
|
|
- if(others.contains("专 科 检 查")){
|
|
|
- String retStr = others.substring(0, others.lastIndexOf("专 科 检 查"));
|
|
|
+
|
|
|
+ String otherStr = others.replace("专 科 检 查","专 科 检 查");
|
|
|
+ if(otherStr.contains("专 科 检 查")){
|
|
|
+ String retStr = otherStr.substring(0, otherStr.lastIndexOf("专 科 检 查"));
|
|
|
if(retStr.contains("专 科 检 查")){
|
|
|
retStr = retStr.substring(0, retStr.lastIndexOf("专 科 检 查"));
|
|
|
}
|
|
@@ -674,6 +734,8 @@ public class BeHospitalizedTran extends TargetTran {
|
|
|
retMap.remove("宫底高度");
|
|
|
retMap.remove("腹围");
|
|
|
retMap.remove("胎心率");
|
|
|
+ retMap.remove("学历");
|
|
|
+ retMap.remove("日吸烟量(支)");
|
|
|
//入院记录
|
|
|
}else{
|
|
|
retMap.remove("出院时间");
|
|
@@ -960,6 +1022,16 @@ public class BeHospitalizedTran extends TargetTran {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public String smokeMethod(String personHistory){
|
|
|
+ personHistory = personHistory.substring(0,personHistory.lastIndexOf("/日"));
|
|
|
+ if(personHistory.contains("吸烟") && personHistory.contains("/日")){
|
|
|
+ personHistory = smokeMethod(personHistory);
|
|
|
+ }else{
|
|
|
+ return personHistory;
|
|
|
+ }
|
|
|
+ return personHistory;
|
|
|
+
|
|
|
+ }
|
|
|
public static void lastSovle(BeHospitalizedDoc beHospitalizedDoc , Map<String,String> rep) {
|
|
|
if(StringUtil.isNotEmpty(rep.get("既往史"))){
|
|
|
rep.remove("既往史");
|