|
@@ -0,0 +1,90 @@
|
|
|
+package com.lantone.structure.facade.tran;
|
|
|
+
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
+import com.lantone.common.util.StringUtil;
|
|
|
+import com.lantone.structure.facade.tran.util.CommonAnalysisUtil;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:病危通知书
|
|
|
+ * @author: wsy
|
|
|
+ * @time: 2021/3/08 11:29
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+public class CriticallyIllNoticeDocTran extends TargetTran {
|
|
|
+ @Override
|
|
|
+ public Map<String, String> convert(String text) {
|
|
|
+ Map<String, String> structureMap = cutWord(text);
|
|
|
+ Map<String, String> retMap = new HashMap<String, String>();
|
|
|
+ CommonAnalysisUtil.mapKeyContrastCommon(structureMap, keyContrasts, retMap);
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, String> cutWord(String text) {
|
|
|
+ Map<String, String> sourceMap = Maps.newHashMap();
|
|
|
+ String dateStr = "";
|
|
|
+ List<String> titles = CommonAnalysisUtil.sortTitles(
|
|
|
+ Lists.newArrayList("科别", "住院号", "入院日期", "入住院日期", "姓名", "性别", "年龄", "职业", "临床诊断", "病情概要", "病重情况", "病情危重情况", "主要抢救措施",
|
|
|
+ "病人家属签名", "关系", "时间", "签名日期", "通知时间", "经治医师"),
|
|
|
+ text
|
|
|
+ );
|
|
|
+ CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
|
|
|
+ List<String> keys = Lists.newArrayList("病情概要", "主要抢救措施");
|
|
|
+ if (sourceMap != null) {
|
|
|
+ joinWord(sourceMap, keys);
|
|
|
+ if (sourceMap.containsKey("时间")) {
|
|
|
+ dateStr = sourceMap.get("时间");
|
|
|
+ } else if (sourceMap.containsKey("签名日期")) {
|
|
|
+ dateStr = sourceMap.get("签名日期");
|
|
|
+ }
|
|
|
+ disDate(sourceMap, dateStr);
|
|
|
+ }
|
|
|
+ return sourceMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void joinWord(Map<String, String> sourceMap, List<String> keys) {
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (String key : keys) {
|
|
|
+ if (sourceMap.containsKey(key)) {
|
|
|
+ sb.append(key + ":" + sourceMap.get(key)).append("\r\n");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sourceMap.put("病情概况及主要抢救措施", sb.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ private void disDate(Map<String, String> sourceMap, String dateStr) {
|
|
|
+ if (StringUtil.isBlank(dateStr)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ int infIndex = dateStr.indexOf("通知时间");
|
|
|
+ int docIndex = dateStr.indexOf("经治医师");
|
|
|
+ if (infIndex > 0) {
|
|
|
+ sourceMap.put("时间", dateStr.substring(0, infIndex));
|
|
|
+ if (docIndex > infIndex) {
|
|
|
+ sourceMap.put("通知时间", dateStr.substring(infIndex, docIndex).replace("通知时间", ""));
|
|
|
+ sourceMap.put("经治医师", dateStr.substring(docIndex).replace("经治医师", ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private List<String> keyContrasts = Lists.newArrayList(
|
|
|
+ "科别=病区名称",
|
|
|
+ "科室=科室名称",
|
|
|
+ "姓名=患者姓名",
|
|
|
+ "病房=病房号",
|
|
|
+ "病床=病床号",
|
|
|
+ "年龄=年龄(岁)",
|
|
|
+ "病重情况=病危(重)通知内容",
|
|
|
+ "病情危重情况=病危(重)通知内容",
|
|
|
+ "通知时间=病危(重)通知日期时间",
|
|
|
+ "病人家属签名=法定代理人签名",
|
|
|
+ "关系=法定代理人与患者关系",
|
|
|
+ "时间=法定代理人签名日期时间",
|
|
|
+ "签名日期=法定代理人签名日期时间",
|
|
|
+ "经治医师=医师签名"
|
|
|
+ );
|
|
|
+}
|