|
@@ -7,9 +7,12 @@ import com.lantone.structure.facade.tran.util.CommonAnalysisUtil;
|
|
|
import com.lantone.structure.model.doc.LeaveHospitalDoc;
|
|
|
import com.lantone.structure.util.MapUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* @Description:出院小结
|
|
@@ -44,18 +47,19 @@ public class LeaveHospitalTran extends TargetTran {
|
|
|
private Map<String, String> cutWord(String text) {
|
|
|
Map<String, String> sourceMap = Maps.newHashMap();
|
|
|
List<String> titles = CommonAnalysisUtil.sortTitles(
|
|
|
- //
|
|
|
- Lists.newArrayList("入院日期","出院日期","入院诊断","入院情况","主要阳性结果","主要阴性结果","阳性结果","阴性结果","住院期间的辅助检查","治疗经过","诊疗经过","出院情况","并发症","治疗效果","出院医嘱","出院注意事项","首席医师","经治/主治医师","填写日期"),
|
|
|
+ Lists.newArrayList("入院日期","出院日期","入院诊断","入院情况","主要阳性结果","主要阴性结果","阳性结果","阴性结果","住院期间的辅助检查","治疗经过","诊疗经过","出院情况","并发症","治疗效果","出院医嘱","营养指导","出院注意事项","首席医师",
|
|
|
+ "经治/主治医师:", "经治/主治医师","填写日期"),
|
|
|
text
|
|
|
);
|
|
|
|
|
|
CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
|
|
|
- if(sourceMap.containsKey("入院诊断")||(sourceMap.containsKey("住院期间的辅助检查"))||(sourceMap.containsKey("出院注意事项"))||sourceMap.containsKey("阴性结果")||sourceMap.containsKey("主要阴性结果")){
|
|
|
+ if(sourceMap.containsKey("入院诊断")||(sourceMap.containsKey("住院期间的辅助检查"))||(sourceMap.containsKey("出院注意事项"))||sourceMap.containsKey("阴性结果")||sourceMap.containsKey("主要阴性结果")||sourceMap.containsKey("营养指导")){
|
|
|
sourceMap.remove("入院诊断");
|
|
|
sourceMap.remove("住院期间的辅助检查");
|
|
|
sourceMap.remove("出院注意事项");
|
|
|
sourceMap.remove("阴性结果");
|
|
|
sourceMap.remove("主要阴性结果");
|
|
|
+ sourceMap.remove("营养指导");
|
|
|
}
|
|
|
return sourceMap;
|
|
|
}
|
|
@@ -94,11 +98,6 @@ public class LeaveHospitalTran extends TargetTran {
|
|
|
|
|
|
public void leaveHospitalContrast( LeaveHospitalDoc leaveHospitalDoc, Map<String, String> retMap) {
|
|
|
if (leaveHospitalDoc != null) {
|
|
|
- if (StringUtil.isNotEmpty(retMap.get("经治/主治医师"))) {
|
|
|
- String value = retMap.get("经治/主治医师");
|
|
|
- String retValue = parseString(value);
|
|
|
- retMap.put("经治/主治医师",retValue);
|
|
|
- }
|
|
|
if (StringUtil.isNotEmpty(retMap.get("出院日期"))) {
|
|
|
String value = retMap.get("出院日期");
|
|
|
if (value.contains("日")) {
|
|
@@ -137,6 +136,39 @@ public class LeaveHospitalTran extends TargetTran {
|
|
|
retMap.remove("治疗效果");
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ if (StringUtil.isNotEmpty(retMap.get("首席医师").trim())) {
|
|
|
+ String firDoctor = retMap.get("首席医师");
|
|
|
+ if(firDoctor.contains("经治/主治医师")){
|
|
|
+ if(StringUtil.isNotEmpty( firDoctor.split("经治/主治医师")[0].trim())){
|
|
|
+ firDoctor = firDoctor.split("经治/主治医师")[0].trim();
|
|
|
+ retMap.put("首席医师",firDoctor);
|
|
|
+ }else{
|
|
|
+ retMap.remove("首席医师");
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty( firDoctor.split("经治/主治医师")[1].trim())){
|
|
|
+ String value = firDoctor.split("经治/主治医师")[1].trim();
|
|
|
+ if(value.contains(":")){
|
|
|
+ value = value.substring(value.indexOf(":")+1);
|
|
|
+ }
|
|
|
+ retMap.put("经治/主治医师",value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ retMap.remove("首席医师");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtil.isNotEmpty(retMap.get("填写日期"))) {
|
|
|
+ String fileDate = retMap.get("填写日期");
|
|
|
+ String sginTime= lastTime(fileDate);
|
|
|
+ retMap.put("填写日期",sginTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtil.isNotEmpty(retMap.get("经治/主治医师"))) {
|
|
|
+ String value = retMap.get("经治/主治医师");
|
|
|
+ String retValue = parseString(value);
|
|
|
+ retMap.put("经治/主治医师",retValue);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -147,4 +179,49 @@ public class LeaveHospitalTran extends TargetTran {
|
|
|
}
|
|
|
return text;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 抽取文本中的最后时间
|
|
|
+ *
|
|
|
+ * @param top
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String lastTime(String top) {
|
|
|
+ Date date = null;
|
|
|
+ try {
|
|
|
+ date = DateUtils.parseDate(top, StringUtil.dateFormats);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ }
|
|
|
+ if(date!= null){
|
|
|
+ return top;
|
|
|
+ }else{
|
|
|
+ if(top.contains("年") && top.contains("月") && top.contains("日")){
|
|
|
+ top = extractDate(top);
|
|
|
+ lastTime(top);
|
|
|
+ }
|
|
|
+ return top;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 抽取文本中的第一个时间
|
|
|
+ *
|
|
|
+ * @param top
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String extractDate(String top) {
|
|
|
+ Pattern pattern = Pattern.compile("[0-9]{4}[-][0-9]{1,2}[-][0-9]{1,2}?");
|
|
|
+ Matcher matcher = pattern.matcher(top);
|
|
|
+ if (matcher.find()) {
|
|
|
+ return matcher.group(0);
|
|
|
+ } else {
|
|
|
+ Pattern p1 = Pattern.compile("[0-9]{4}年[0-9]+月[0-9]+日");
|
|
|
+ Matcher m1 = p1.matcher(top);
|
|
|
+ if (m1.find()) {
|
|
|
+ return m1.group(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|