|
@@ -8,6 +8,7 @@ import com.lantone.structure.model.doc.DeathCaseDiscussDoc;
|
|
|
|
|
|
import com.lantone.structure.util.MapUtil;
|
|
import com.lantone.structure.util.MapUtil;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -41,8 +42,7 @@ public class DeathCaseDiscussionTran extends TargetTran {
|
|
"参加人员=参加讨论人员名单",
|
|
"参加人员=参加讨论人员名单",
|
|
"死亡诊断=死亡诊断名称",
|
|
"死亡诊断=死亡诊断名称",
|
|
"讨论摘要=死亡讨论记录",
|
|
"讨论摘要=死亡讨论记录",
|
|
- "主持人总结=主持人总结意见",
|
|
|
|
- "讨论主持人=主治医师签名"
|
|
|
|
|
|
+ "主持人总结=主持人总结意见"
|
|
|
|
|
|
);
|
|
);
|
|
private Map<String, String> cutWord(String text) {
|
|
private Map<String, String> cutWord(String text) {
|
|
@@ -57,10 +57,7 @@ public class DeathCaseDiscussionTran extends TargetTran {
|
|
Lists.newArrayList("﹙副﹚主任医师","主治医师","医师","护士"),
|
|
Lists.newArrayList("﹙副﹚主任医师","主治医师","医师","护士"),
|
|
text
|
|
text
|
|
);
|
|
);
|
|
- /* String stringDate =extractDate(text) ;
|
|
|
|
- if(StringUtils.isNotEmpty(stringDate)){
|
|
|
|
- sourceMap.put("讨论日期时间",stringDate);
|
|
|
|
- }*/
|
|
|
|
|
|
+
|
|
CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
|
|
CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
|
|
CommonAnalysisUtil.cutByTitles(text, ftitles, 0, sourceMap);
|
|
CommonAnalysisUtil.cutByTitles(text, ftitles, 0, sourceMap);
|
|
if(sourceMap.containsKey("性别")||sourceMap.containsKey("床号")||sourceMap.containsKey("汇报病史")||sourceMap.containsKey("护士")){
|
|
if(sourceMap.containsKey("性别")||sourceMap.containsKey("床号")||sourceMap.containsKey("汇报病史")||sourceMap.containsKey("护士")){
|
|
@@ -116,16 +113,10 @@ public class DeathCaseDiscussionTran extends TargetTran {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public static String extractDate(String top) {
|
|
public static String extractDate(String top) {
|
|
- Pattern pattern = Pattern.compile("[0-9]{4}[-][0-9]{1,2}[-][0-9]{1,2}([ ][0-9]{1,2}[:][0-9]{1,2}([:][0-9]{1,2})?)?");
|
|
|
|
|
|
+ Pattern pattern = Pattern.compile("[0-9]{4}");
|
|
Matcher matcher = pattern.matcher(top);
|
|
Matcher matcher = pattern.matcher(top);
|
|
if (matcher.find()) {
|
|
if (matcher.find()) {
|
|
return matcher.group(0);
|
|
return matcher.group(0);
|
|
- } else {
|
|
|
|
- Pattern p1 = Pattern.compile("[0-9]{4}年[0-9]+月[0-9]+日[0-9]+时[0-9]+分");
|
|
|
|
- Matcher m1 = p1.matcher(top);
|
|
|
|
- if (m1.find()) {
|
|
|
|
- return m1.group(0);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
@@ -151,11 +142,25 @@ public class DeathCaseDiscussionTran extends TargetTran {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //主持人姓名去职称
|
|
|
|
+ List<String>titleStr = Lists.newArrayList("﹙副﹚主任医师","(副)主任医师","副主任医师", "主治医师","主任医师",
|
|
|
|
+ "住院医师","医师", "护士");
|
|
|
|
+ for (String timeName : titleStr) {
|
|
|
|
+ String dirName = retMap.get("讨论主持人");
|
|
|
|
+ if (StringUtil.isNotEmpty(dirName)) {
|
|
|
|
+ if (dirName.contains(timeName)) {
|
|
|
|
+ retMap.put("讨论主持人", dirName.split(timeName)[0]);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//参加讨论人员名单
|
|
//参加讨论人员名单
|
|
- // "﹙副﹚主任医师","主治医师","医师"),
|
|
|
|
|
|
+
|
|
|
|
+ // 去掉最后无法识别的名字,例如 徐金印医师汇报病史 该名会出现在参加人员名单上排除法处理
|
|
List<String> attendNames = new ArrayList<>();
|
|
List<String> attendNames = new ArrayList<>();
|
|
- String targetRet = "";
|
|
|
|
- if(StringUtil.isNotEmpty(retMap.get("参加人员"))){
|
|
|
|
|
|
+ StringBuffer targetRet = new StringBuffer();
|
|
|
|
+ if(StringUtil.isNotEmpty(retMap.get("参加人员"))){
|
|
if(StringUtil.isNotEmpty(retMap.get("﹙副﹚主任医师"))) {
|
|
if(StringUtil.isNotEmpty(retMap.get("﹙副﹚主任医师"))) {
|
|
String rName = retMap.get("﹙副﹚主任医师");
|
|
String rName = retMap.get("﹙副﹚主任医师");
|
|
transAdd(rName, attendNames);
|
|
transAdd(rName, attendNames);
|
|
@@ -164,22 +169,43 @@ public class DeathCaseDiscussionTran extends TargetTran {
|
|
if(StringUtil.isNotEmpty(retMap.get("主治医师"))) {
|
|
if(StringUtil.isNotEmpty(retMap.get("主治医师"))) {
|
|
String rName = retMap.get("主治医师");
|
|
String rName = retMap.get("主治医师");
|
|
transAdd(rName, attendNames);
|
|
transAdd(rName, attendNames);
|
|
- retMap.remove("主治医师");
|
|
|
|
}
|
|
}
|
|
if(StringUtil.isNotEmpty(retMap.get("医师"))) {
|
|
if(StringUtil.isNotEmpty(retMap.get("医师"))) {
|
|
String rName = retMap.get("医师");
|
|
String rName = retMap.get("医师");
|
|
transAdd(rName, attendNames);
|
|
transAdd(rName, attendNames);
|
|
- retMap.remove("医师");
|
|
|
|
}
|
|
}
|
|
String attendName = retMap.get("参加人员");
|
|
String attendName = retMap.get("参加人员");
|
|
- String spiltString = attendName.substring(attendName.indexOf("护士"), attendName.lastIndexOf("医师"));
|
|
|
|
|
|
+ String spiltString = attendName.substring(attendName.indexOf("护士")+2, attendName.lastIndexOf("医师"));
|
|
for (String name : attendNames) {
|
|
for (String name : attendNames) {
|
|
if(spiltString.contains(name)){
|
|
if(spiltString.contains(name)){
|
|
- targetRet = attendName.substring(0, attendName.lastIndexOf(name));
|
|
|
|
|
|
+ String retData = attendName.substring(0, attendName.lastIndexOf(name));
|
|
|
|
+ String replace = retData;
|
|
|
|
+ //职称与姓名空格区分
|
|
|
|
+ if( retData.contains("主治医师:")){
|
|
|
|
+ retData = retData.substring(0,retData.indexOf("主治医师:"));
|
|
|
|
+ if(StringUtil.isNotEmpty(retData)){
|
|
|
|
+ targetRet.append(retData+" ");
|
|
|
|
+ }
|
|
|
|
+ if(StringUtil.isNotEmpty(retMap.get("主治医师"))){
|
|
|
|
+ targetRet.append("主治医师:"+retMap.get("主治医师")+" ");
|
|
|
|
+ }
|
|
|
|
+ if(StringUtil.isNotEmpty(retMap.get("医师"))){
|
|
|
|
+ targetRet.append("医师:"+retMap.get("医师")+" ");
|
|
|
|
+ }
|
|
|
|
+ String rec = "";
|
|
|
|
+
|
|
|
|
+ if( replace.contains("护士:")){
|
|
|
|
+ rec = replace.substring(replace.lastIndexOf("护士:"));
|
|
|
|
+ }
|
|
|
|
+ if(StringUtil.isNotEmpty(rec)){
|
|
|
|
+ targetRet.append(rec);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- retMap.put("参加人员",targetRet);
|
|
|
|
|
|
+ retMap.remove("主治医师");
|
|
|
|
+ retMap.remove("医师");
|
|
|
|
+ retMap.put("参加人员",targetRet.toString());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -199,21 +225,29 @@ public class DeathCaseDiscussionTran extends TargetTran {
|
|
//主持人签名
|
|
//主持人签名
|
|
if(StringUtil.isNotEmpty(retMap.get("主持人总结"))){
|
|
if(StringUtil.isNotEmpty(retMap.get("主持人总结"))){
|
|
String directSummary = retMap.get("主持人总结");
|
|
String directSummary = retMap.get("主持人总结");
|
|
|
|
+
|
|
|
|
+ //签名日期时间
|
|
|
|
+ if(directSummary.contains("记录者(签名)")) {
|
|
|
|
+ String sginTime= lastTime(directSummary);
|
|
|
|
+ if(StringUtil.isNotEmpty(sginTime)){
|
|
|
|
+ retMap.put("签名日期时间", sginTime);
|
|
|
|
+ }
|
|
|
|
+
|
|
String trueRet = "";
|
|
String trueRet = "";
|
|
- String signDateTime = "";
|
|
|
|
if(directSummary.contains("主持人(签名)") && directSummary.contains("记录者(签名)")){
|
|
if(directSummary.contains("主持人(签名)") && directSummary.contains("记录者(签名)")){
|
|
- trueRet = directSummary.substring( directSummary.indexOf("主持人(签名)")+7, directSummary.indexOf("记录者(签名)"));
|
|
|
|
|
|
+ trueRet = directSummary.substring( directSummary.indexOf("主持人(签名)")+7, directSummary.indexOf("记录者(签名)")).trim();
|
|
}
|
|
}
|
|
|
|
+ if(directSummary.contains(" 记录者(签名)")){
|
|
|
|
+ String signTimme = retMap.get("签名日期时间");
|
|
|
|
+ if(StringUtil.isNotEmpty(signTimme)){
|
|
|
|
+ String recordRet = directSummary.substring(directSummary.indexOf("记录者(签名)")+7,directSummary.indexOf( signTimme.split("年")[0])).trim();
|
|
|
|
+ retMap.put("主治医师签名",recordRet);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if(StringUtil.isNotEmpty(trueRet)){
|
|
if(StringUtil.isNotEmpty(trueRet)){
|
|
retMap.put("主任医师签名",trueRet);
|
|
retMap.put("主任医师签名",trueRet);
|
|
}
|
|
}
|
|
-
|
|
|
|
- //签名日期时间
|
|
|
|
- if(directSummary.contains("记录者(签名)")) {
|
|
|
|
- signDateTime = directSummary.substring(directSummary.indexOf("记录者(签名)") + 7);
|
|
|
|
- if (StringUtil.isNotEmpty(signDateTime)) {
|
|
|
|
- retMap.put("签名日期时间", signDateTime);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -226,10 +260,47 @@ public class DeathCaseDiscussionTran extends TargetTran {
|
|
}
|
|
}
|
|
retMap.put("主持人总结",trueRet);
|
|
retMap.put("主持人总结",trueRet);
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 抽取文本中的最后时间
|
|
|
|
+ *
|
|
|
|
+ * @param top
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static String lastTime(String top) {
|
|
|
|
+ int length = top.trim().length();
|
|
|
|
+ String substring = top.trim().substring(length - 22, length);
|
|
|
|
+ String stringDate = "";
|
|
|
|
+ if( substring.contains("年")){
|
|
|
|
+ String[] time = substring.split("年");
|
|
|
|
+ String timeYear = time[0].trim();
|
|
|
|
+ timeYear = extractDate(timeYear);
|
|
|
|
+ if( substring.contains("月")){
|
|
|
|
+ String[] timeLater = time[1].split("月");
|
|
|
|
+ String timeMouth = timeLater[0].trim();
|
|
|
|
+ if(substring.contains("日")){
|
|
|
|
+ String[] timeLast = timeLater[1].split("日");
|
|
|
|
+ String timeDate = timeLast[0].trim();
|
|
|
|
+ if(StringUtil.isNotEmpty(timeYear) && StringUtil.isNotEmpty(timeMouth) && StringUtil.isNotEmpty(timeDate)){
|
|
|
|
+ stringDate = timeYear + "年" + timeMouth + "月" + timeDate + "日" ;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Date date = null;
|
|
|
|
+ try {
|
|
|
|
+ date = DateUtils.parseDate(stringDate, StringUtil.dateFormats);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
|
+ }
|
|
|
|
+ if(date!= null){
|
|
|
|
+ return stringDate;
|
|
|
|
+ }else{
|
|
|
|
+ return "";
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private String resultHandle(String value) {
|
|
private String resultHandle(String value) {
|
|
@@ -241,14 +312,41 @@ public class DeathCaseDiscussionTran extends TargetTran {
|
|
}
|
|
}
|
|
return value;
|
|
return value;
|
|
}
|
|
}
|
|
|
|
+ //递归添加到集合
|
|
public void transAdd(String name, List<String> attendName){
|
|
public void transAdd(String name, List<String> attendName){
|
|
- if(name.contains("、")){
|
|
|
|
- String value = name.substring(name.lastIndexOf("、")+1);
|
|
|
|
|
|
+ if(name.contains("、") || name.contains(" ")){
|
|
|
|
+ String value = "";
|
|
|
|
+ if(name.contains("、")){
|
|
|
|
+ value = name.substring(name.lastIndexOf("、")+1);
|
|
|
|
+ name = name.substring(0,name.lastIndexOf("、"));
|
|
|
|
+ }
|
|
|
|
+ if(name.contains(" ")){
|
|
|
|
+ value = name.substring(name.lastIndexOf(" ")+1);
|
|
|
|
+ name = name.substring(0,name.lastIndexOf(" "));
|
|
|
|
+ }
|
|
if(StringUtil.isNotEmpty(value)){
|
|
if(StringUtil.isNotEmpty(value)){
|
|
|
|
+ if(value.contains("主任")){
|
|
|
|
+ value = value.substring(0, value.indexOf("主任"));
|
|
|
|
+ }
|
|
|
|
+ if(value.contains("主治")) {
|
|
|
|
+ value = value.substring(0, value.indexOf("主治"));
|
|
|
|
+ }
|
|
|
|
+ if(value.contains("医师")){
|
|
|
|
+ value = value.substring(0,value.indexOf("医师"));
|
|
|
|
+ }
|
|
attendName.add(value);
|
|
attendName.add(value);
|
|
}
|
|
}
|
|
- transAdd(name.substring(0, name.lastIndexOf("、")), attendName);
|
|
|
|
|
|
+ transAdd(name, attendName);
|
|
}else{
|
|
}else{
|
|
|
|
+ if(name.contains("主任")){
|
|
|
|
+ name = name.substring(0, name.indexOf("主任"));
|
|
|
|
+ }
|
|
|
|
+ if(name.contains("主治")) {
|
|
|
|
+ name = name.substring(0, name.indexOf("主治"));
|
|
|
|
+ }
|
|
|
|
+ if(name.contains("医师")){
|
|
|
|
+ name = name.substring(0,name.indexOf("医师"));
|
|
|
|
+ }
|
|
attendName.add(name);
|
|
attendName.add(name);
|
|
}
|
|
}
|
|
}
|
|
}
|