|
@@ -10,10 +10,9 @@ import com.lantone.structure.model.entity.*;
|
|
|
import com.lantone.structure.model.label.RescueLabel;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
@@ -54,7 +53,7 @@ public class RescueTran extends TargetTran {
|
|
|
|
|
|
public void rescueContrast(String text, List<RescueDoc> rescueDocs,Map<String, String> retMap) {
|
|
|
if(ListUtil.isNotEmpty(rescueDocs)){
|
|
|
- List<String> str= Arrays.asList("修正诊断", "补充诊断","入院后辅助检查补充","辅助检查补充","抢救情况",".","。","/");
|
|
|
+ List<String> str= Arrays.asList("修正诊断", "补充诊断","入院后辅助检查补充","辅助检查补充","抢救情况","。",".","/");
|
|
|
if(StringUtils.isNotEmpty(retMap.get("参与现场抢救的医务人员"))){
|
|
|
String rescuePersons = retMap.get("参与现场抢救的医务人员");
|
|
|
for (String s : str) {
|
|
@@ -205,9 +204,11 @@ public class RescueTran extends TargetTran {
|
|
|
}
|
|
|
}
|
|
|
if(ListUtil.isNotEmpty(strDate)){
|
|
|
- retMap.put("抢救开始日期时间",strDate.get(0));
|
|
|
+ String startHmsTime = transHmTime(strDate.get(0));
|
|
|
+ retMap.put("抢救开始日期时间",startHmsTime);
|
|
|
if(strDate.size()>1 && ! strDate.get(0).equals(strDate.get(strDate.size()-1))){
|
|
|
- retMap.put("抢救结束日期时间",strDate.get(strDate.size()-1));
|
|
|
+ String endHmsTime = transHmTime(strDate.get(strDate.size() - 1));
|
|
|
+ retMap.put("抢救结束日期时间",endHmsTime);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -224,20 +225,38 @@ public class RescueTran extends TargetTran {
|
|
|
retMap.put("病情变化情况",conditionsString.toString());
|
|
|
}
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(retMap.get("抢救开始日期时间")) && !(retMap.get("抢救开始日期时间").contains("年") || retMap.get("抢救开始日期时间").contains("-"))){
|
|
|
- String date = extractDate(text);
|
|
|
- if(StringUtils.isNotEmpty(date.trim())){
|
|
|
- retMap.put("抢救开始日期时间",date+" "+retMap.get("抢救开始日期时间"));
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(retMap.get("抢救开始日期时间"))){
|
|
|
+ String resuceStartDate = retMap.get("抢救开始日期时间");
|
|
|
+ if(!resuceStartDate.contains("年")){
|
|
|
+ String date = transDate(extractDate(text));
|
|
|
+ if(StringUtils.isNotEmpty(date.trim())){
|
|
|
+ resuceStartDate= date+" "+resuceStartDate;
|
|
|
+ retMap.put("抢救开始日期时间",resuceStartDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String flagTime = resuceStartDate.substring(resuceStartDate.lastIndexOf("日"), resuceStartDate.lastIndexOf("时"));
|
|
|
+ if(!flagTime.contains(" ")){
|
|
|
+ resuceStartDate = resuceStartDate.replace("日", "日 ");
|
|
|
+ retMap.put("抢救开始日期时间",resuceStartDate);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(retMap.get("抢救结束日期时间")) && !(retMap.get("抢救结束日期时间").contains("年") || retMap.get("抢救结束日期时间").contains("-"))){
|
|
|
- String date = extractDate(text);
|
|
|
- if(StringUtils.isNotEmpty(date.trim())){
|
|
|
- retMap.put("抢救结束日期时间",date+" "+retMap.get("抢救结束日期时间"));
|
|
|
+ if(StringUtils.isNotEmpty(retMap.get("抢救结束日期时间"))){
|
|
|
+ String resuceStartDate = retMap.get("抢救开始日期时间");
|
|
|
+ String resuceEndDate = retMap.get("抢救结束日期时间");
|
|
|
+ if(!resuceEndDate.contains("年")){
|
|
|
+ String date = resuceStartDate.split("日")[0];
|
|
|
+ if(StringUtils.isNotEmpty(date.trim())){
|
|
|
+ resuceEndDate= date+"日 "+resuceEndDate;
|
|
|
+ retMap.put("抢救结束日期时间",resuceEndDate);
|
|
|
+ }
|
|
|
}
|
|
|
+ compareDate(resuceStartDate,resuceEndDate,retMap);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
if(ListUtil.isNotEmpty(rescueLabel.getDiagnosis())){
|
|
|
for (Diagnosis diagnosis : rescueLabel.getDiagnosis()) {
|
|
|
if(StringUtils.isNotEmpty(diagnosis.getName())){
|
|
@@ -299,4 +318,67 @@ public class RescueTran extends TargetTran {
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
-}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 时间比较
|
|
|
+ *
|
|
|
+ * @param startTime,endTime
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static void compareDate(String startTime,String endTime,Map<String, String> retMap) {
|
|
|
+ if(StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)){
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ SimpleDateFormat dateFormatSec = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分");
|
|
|
+ try {
|
|
|
+ long start = dateFormatSec.parse(startTime).getTime();
|
|
|
+ long end = dateFormatSec.parse(endTime).getTime();
|
|
|
+ if(start>end){
|
|
|
+ retMap.remove("抢救结束日期时间");
|
|
|
+ }
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String transHmTime(String time) {
|
|
|
+ if(StringUtils.isEmpty(time)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ time = time.replace(":", ":").replace("::", ":").replace("于", "");
|
|
|
+ if(time.contains(":")){
|
|
|
+ time = time.replace("时", "").replace("分", "");
|
|
|
+ }
|
|
|
+ if(time.contains(":") && !time.contains("-")){
|
|
|
+ String[] split = time.split(":");
|
|
|
+ time = split[0]+"时"+ split[1]+"分";
|
|
|
+ }
|
|
|
+ if(time.contains("秒") && time.contains("分")){
|
|
|
+ time.substring(time.lastIndexOf("分")+"分".length());
|
|
|
+ }
|
|
|
+ //完整时间
|
|
|
+ if(time.contains("-") && time.contains("时")){
|
|
|
+ String hmsDate = time.substring(time.lastIndexOf(extractDate(time))+extractDate(time).length()).trim();
|
|
|
+ String filterTime = transDate(extractDate(time));
|
|
|
+ return filterTime+" "+hmsDate;
|
|
|
+ }
|
|
|
+ return time;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 时间格式转换
|
|
|
+ *
|
|
|
+ * @param time
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String transDate(String time) {
|
|
|
+ if(StringUtils.isEmpty(time)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if(time.contains("-")) {
|
|
|
+ String[] split = time.split("-");
|
|
|
+ time = split[0]+"年"+split[1]+"月"+ split[2]+"日";
|
|
|
+ }
|
|
|
+ return time;
|
|
|
+ }
|
|
|
+ }
|