|
@@ -4,10 +4,13 @@ import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
|
|
|
import com.lantone.qc.pub.model.vo.MedrecVo;
|
|
|
-import com.lantone.qc.pub.util.MapUtil;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
import com.lantone.qc.trans.ModelDocTrans;
|
|
|
+import com.lantone.qc.trans.changx.util.CxXmlUtil;
|
|
|
import com.lantone.qc.trans.comsis.ModelDocGenerate;
|
|
|
+import com.lantone.qc.trans.comsis.OrdinaryAssistant;
|
|
|
import com.lantone.qc.trans.comsis.Preproc;
|
|
|
+import org.dom4j.DocumentHelper;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -22,7 +25,31 @@ public class ChangxFirstCourseRecordDocTrans extends ModelDocTrans {
|
|
|
@Override
|
|
|
public FirstCourseRecordDoc extract(MedrecVo medrecVo) {
|
|
|
String content = ((List<String>) medrecVo.getContent().get("content")).get(0);
|
|
|
+ String text = getModelText(content);
|
|
|
+ Map<String, String> cutWordMap = getCutWordMap(text);
|
|
|
+ Map<String, String> xmlNodeValueMap = CxXmlUtil.firstLevelNodeValue("//DocObjContent//Region", content);
|
|
|
+ cutWordMap.putAll(xmlNodeValueMap);
|
|
|
+ Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(cutWordMap, keyContrasts);
|
|
|
+ FirstCourseRecordDoc firstCourseRecordDoc = ModelDocGenerate.firstCourseRecordDocGen(structureMap);
|
|
|
+ firstCourseRecordDoc.setText(text);
|
|
|
+ firstCourseRecordDoc.setPageData((Map) xmlNodeValueMap);
|
|
|
+ return firstCourseRecordDoc;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getModelText(String xml) {
|
|
|
+ String content = null;
|
|
|
+ try {
|
|
|
+ content = DocumentHelper.parseText(xml).getRootElement().element("DocObjContent").element("Region").element("Content_Text").getTextTrim();
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ return content;
|
|
|
+ }
|
|
|
|
|
|
+ private Map<String, String> getCutWordMap(String content) {
|
|
|
+ Map<String, String> retMap = Maps.newHashMap();
|
|
|
+ if (StringUtil.isBlank(content)) {
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
List<String> targetTitles = Lists.newArrayList();
|
|
|
sourceTitles.forEach(sourceTitle -> {
|
|
|
String targetTitle = "[一二三四五六七八九十]{0,1}[、.]{0,1}";
|
|
@@ -35,38 +62,49 @@ public class ChangxFirstCourseRecordDocTrans extends ModelDocTrans {
|
|
|
}
|
|
|
targetTitles.add(targetTitle);
|
|
|
});
|
|
|
-
|
|
|
Map<String, String> sourceMap = Preproc.extract_doc_pub(true, targetTitles, content);
|
|
|
- Map<String, String> targetMap = Maps.newHashMap();
|
|
|
for (String key : sourceMap.keySet()) {
|
|
|
- targetMap.put(key.replaceAll("[一二三四五六七八九十][、.]", ""), sourceMap.get(key));
|
|
|
+ retMap.put(key.replaceAll("[一二三四五六七八九十][、.]", ""), sourceMap.get(key));
|
|
|
}
|
|
|
- targetMap.put("记录时间", sourceMap.get("病程记录时间"));
|
|
|
- Map<String, String> pageData = MapUtil.copyMap((Map) targetMap);
|
|
|
- pageData.put("病程记录内容",
|
|
|
- pageData.get("病程记录内容")
|
|
|
- .replace(pageData.get("病程记录时间"), "")
|
|
|
- .replace(pageData.get("病程记录名称"), "")
|
|
|
- );
|
|
|
-
|
|
|
- FirstCourseRecordDoc firstCourseRecordDoc = ModelDocGenerate.firstCourseRecordDocGen(targetMap);
|
|
|
- firstCourseRecordDoc.setText(content);
|
|
|
- firstCourseRecordDoc.setPageData((Map) pageData);
|
|
|
-
|
|
|
- return firstCourseRecordDoc;
|
|
|
+ return retMap;
|
|
|
}
|
|
|
|
|
|
private List<String> sourceTitles = Lists.newArrayList(
|
|
|
- "病程记录时间",
|
|
|
- "病程记录名称",
|
|
|
- "病程记录内容",
|
|
|
"病例特点",
|
|
|
"初步诊断",
|
|
|
"诊断依据",
|
|
|
"鉴别诊断",
|
|
|
- "诊疗计划",
|
|
|
- "记录医师",
|
|
|
- "记录时间"
|
|
|
+ "诊疗计划"
|
|
|
+ );
|
|
|
+
|
|
|
+ private List<String> keyContrasts = Lists.newArrayList(
|
|
|
+ "记录日期=记录时间",
|
|
|
+ "姓名++++患者姓名=",
|
|
|
+ "性别=",
|
|
|
+ "年龄=",
|
|
|
+ "职业=",
|
|
|
+ "主诉=",
|
|
|
+ "入院日期=",
|
|
|
+ "现病史=",
|
|
|
+ "既往史=",
|
|
|
+ "体格检查=",
|
|
|
+ "辅助检查++++检查=",
|
|
|
+ "初步诊断=",
|
|
|
+ "体温=",
|
|
|
+ "脉搏++++第一次脉搏=",
|
|
|
+ "呼吸++++第一次呼吸=",
|
|
|
+ "血压++++第一次血压=",
|
|
|
+ "专科检查=",
|
|
|
+ "辅助检查=",
|
|
|
+ "鉴别诊断=",
|
|
|
+ "需求评估=",
|
|
|
+ "预期目标=",
|
|
|
+ "诊疗计划=",
|
|
|
+ "治疗监测计划=",
|
|
|
+ "签名++++=记录医师",
|
|
|
+ "签名时间=",
|
|
|
+ "诊断依据=",
|
|
|
+ "病例特点="
|
|
|
);
|
|
|
|
|
|
}
|