|
@@ -3,20 +3,13 @@ package com.lantone.qc.trans.yiwu;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.lantone.qc.dbanaly.facade.yiwu.YiWuXmlUtil;
|
|
|
import com.lantone.qc.dbanaly.util.ModuleMappingUtil;
|
|
|
+import com.lantone.qc.dbanaly.util.SpecialStorageUtil;
|
|
|
import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
|
|
|
-import com.lantone.qc.pub.model.label.ChiefLabel;
|
|
|
-import com.lantone.qc.pub.model.label.DiagLabel;
|
|
|
-import com.lantone.qc.pub.model.label.FamilyLabel;
|
|
|
-import com.lantone.qc.pub.model.label.MaritalLabel;
|
|
|
-import com.lantone.qc.pub.model.label.MenstrualLabel;
|
|
|
-import com.lantone.qc.pub.model.label.PacsLabel;
|
|
|
-import com.lantone.qc.pub.model.label.PastLabel;
|
|
|
-import com.lantone.qc.pub.model.label.PersonalLabel;
|
|
|
-import com.lantone.qc.pub.model.label.PresentLabel;
|
|
|
-import com.lantone.qc.pub.model.label.VitalLabel;
|
|
|
-import com.lantone.qc.pub.model.label.VitalLabelSpecial;
|
|
|
+import com.lantone.qc.pub.model.label.*;
|
|
|
+import com.lantone.qc.pub.model.vo.BehospitalInfoVO;
|
|
|
import com.lantone.qc.pub.model.vo.MedrecVo;
|
|
|
import com.lantone.qc.pub.util.FastJsonUtils;
|
|
|
+import com.lantone.qc.pub.util.SpringContextUtil;
|
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
import com.lantone.qc.trans.ModelDocTrans;
|
|
|
import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
|
|
@@ -42,108 +35,90 @@ public class YiWuBeHospitalizedDocTrans extends ModelDocTrans {
|
|
|
public BeHospitalizedDoc extract(MedrecVo medrecVo) {
|
|
|
Map<String, Object> contentMap = ((List<Map>) medrecVo.getContent().get("content")).get(0);
|
|
|
String content = contentMap.get("xmlText").toString();
|
|
|
-
|
|
|
+ SpecialStorageUtil specialStorageUtil = SpringContextUtil.getBean("specialStorageUtil");
|
|
|
+ BehospitalInfoVO behospitalInfoVO = specialStorageUtil.getBehospitalInfoThreadLocal().get();
|
|
|
Map<String, String> structureMap = null;
|
|
|
if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
|
|
|
structureMap = (Map) FastJsonUtils.getJsonToMap(content);
|
|
|
} else {
|
|
|
Map<String, String> sourceMap = YiWuXmlUtil.xmlToMap(content);
|
|
|
sourceMap.put("mode_id", ModuleMappingUtil.getDeptModuleId(modeId));
|
|
|
- if (sourceMap.containsKey("辅助检查") && sourceMap.containsKey("特殊检查")) {
|
|
|
- sourceMap.put("辅助检查", sourceMap.get("辅助检查") + "\n" + sourceMap.get("特殊检查"));
|
|
|
- }
|
|
|
- //日间病历修改医师签名时间
|
|
|
- modifySignDate(sourceMap);
|
|
|
- List<String> titles = Lists.newArrayList("婚 姻", "婚姻状况", "住 址", "供 史 者", "性 别", "婚 姻", "民 族", "民 族", "个人史", "妇科检查", "产科检查",
|
|
|
- "实验室", "初步诊断", "修正诊断", "医生签名", "补充诊断", "医师签名", "日 期", "诊断和诊断修正","婚 育 史","家 族 史","体格检查(一)","现 病 史","既 往 史","系统回顾");
|
|
|
- String text = sourceMap.get("原始文本");
|
|
|
- List<String> sortTitles = CommonAnalysisUtil.sortTitlesNoColon(titles, text);
|
|
|
- CommonAnalysisUtil.cutByTitlesNoColon(text, sortTitles, 0, sourceMap);
|
|
|
- //产科生的孩子的性别
|
|
|
- /*Map<String, String> addEntry = Maps.newHashMap();
|
|
|
- sourceMap.forEach((k, v) -> {
|
|
|
- if (("男").equals(v) || ("男性").equals(v) || ("女").equals(v) || ("女性").equals(v)) {
|
|
|
- addEntry.put("性别", v);
|
|
|
+ String text = sourceMap.get("原始文本").replace(":", ":").replace("■", "");
|
|
|
+ //日间病历单独处理
|
|
|
+ String behDeptId = behospitalInfoVO.getBehDeptId();
|
|
|
+ if ("51923".equals(behDeptId) || "52883".equals(behDeptId) || "52903".equals(behDeptId) || "52923".equals(behDeptId) || "53523".equals(behDeptId)) {
|
|
|
+ dailyTrans(sourceMap, text, behDeptId);
|
|
|
+ } else {
|
|
|
+ List<String> titles = Lists.newArrayList("婚 姻", "婚姻状况", "住 址", "供 史 者", "性 别", "婚 姻", "民 族", "民 族", "个人史", "妇科检查", "产科检查",
|
|
|
+ "实验室", "初步诊断", "修正诊断", "补充诊断", "初步诊断医师", "修正诊断医师", "补充诊断医师", "初步诊断日期", "修正诊断日期", "补充诊断日期", "诊断和诊断修正");
|
|
|
+ List<String> modifyKey = Lists.newArrayList("初步诊断", "修正诊断", "补充诊断");
|
|
|
+ List<String> sortTitles = CommonAnalysisUtil.sortTitlesNoColon(modifyKey, text);
|
|
|
+ for (String key : sortTitles) {
|
|
|
+ text = modifyDiagKey(text, key);
|
|
|
}
|
|
|
- });
|
|
|
- sourceMap.putAll(addEntry);*/
|
|
|
- //妇科日间出院医嘱部分特殊处理
|
|
|
- List<String> titles1 = Lists.newArrayList("注意事项", "医生办公室电话", "随访安排", "活动能力与生活自理情况"
|
|
|
- , "出院带药", "出院去向");
|
|
|
- String text1 = sourceMap.get("出院医嘱");
|
|
|
- if (text1 != null) {
|
|
|
- text1.replaceAll("[0-9,、]", "");
|
|
|
- List<String> sortTitles1 = CommonAnalysisUtil.sortTitles(titles1, text1);
|
|
|
- CommonAnalysisUtil.cutByTitles(text1, sortTitles1, 0, sourceMap);
|
|
|
- }
|
|
|
- sourceMap.put("mode_id=" + contentMap.get("modeId").toString(), "");
|
|
|
- sourceMap.put("rec_title=" + contentMap.get("recTitle").toString(), "");
|
|
|
-
|
|
|
- //新生儿科姓名+姓名问题解决
|
|
|
- if (StringUtils.isNotEmpty(sourceMap.get("姓名"))) {
|
|
|
- String value = sourceMap.get("姓名").split(" ")[0];
|
|
|
- sourceMap.put("姓名", value);
|
|
|
- }
|
|
|
- //产科孕产次
|
|
|
- if (StringUtils.isNotEmpty(sourceMap.get("入院记录"))) {
|
|
|
- String value = sourceMap.get("入院记录").split(" ")[0];
|
|
|
- sourceMap.put("孕产次", value);
|
|
|
- }
|
|
|
- //入院记录下方的记录者签名和时间
|
|
|
- List<String> diagnosetitles = Lists.newArrayList("修正诊断",
|
|
|
- "诊断和诊断修正", "补充诊断");
|
|
|
- for (String diagnose : diagnosetitles) {
|
|
|
- if (StringUtils.isNotEmpty(sourceMap.get(diagnose))){
|
|
|
- String value = sourceMap.get(diagnose).replaceAll("医师签名", "")
|
|
|
- .replaceAll(":|日 期|■|补充诊断|修正诊断|\"|:|日期|医生签名|签名时间", "")
|
|
|
- .replaceAll("[0-9]{4}-[0-9]{2}-[0-9]{2}", "")
|
|
|
- .replace("--", "");
|
|
|
- sourceMap.put(diagnose, value);
|
|
|
+ sortTitles = CommonAnalysisUtil.sortTitles(titles, text);
|
|
|
+ CommonAnalysisUtil.cutByTitles(text, sortTitles, 0, sourceMap);
|
|
|
+ if (sourceMap.containsKey("修正诊断") && (sourceMap.get("修正诊断").contains(":") || sourceMap.get("修正诊断").contains(":"))) {
|
|
|
+ sourceMap.put("修正诊断", "");
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if (StringUtils.isNotEmpty(sourceMap.get("初步诊断医师签名"))) {
|
|
|
- String value = sourceMap.get("初步诊断").replaceAll("日期|:|医师签名", "");
|
|
|
- sourceMap.put("初步诊断", value);
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(sourceMap.get("医师签名"))) {
|
|
|
- String value = sourceMap.get("医师签名").replaceAll("日期|:|医师签名|--|", "")
|
|
|
- .replaceAll("\\d", "");
|
|
|
- sourceMap.put("医师签名", value);
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(sourceMap.get("医生签名"))) {
|
|
|
- String value = sourceMap.get("医生签名").replaceAll("日期|:|医生签名|签名时间|--", "")
|
|
|
- .replaceAll("\\d", "");
|
|
|
- sourceMap.put("医生签名", value);
|
|
|
- }
|
|
|
- //产科入院记录个人史处理
|
|
|
- if (StringUtils.isNotEmpty(sourceMap.get("个人史"))) {
|
|
|
- String value = sourceMap.get("个人史").split("月经史")[0];
|
|
|
- sourceMap.put("个人史", value);
|
|
|
- }
|
|
|
+ //妇科日间出院医嘱部分特殊处理
|
|
|
+ List<String> titles1 = Lists.newArrayList("注意事项", "医生办公室电话", "随访安排", "活动能力与生活自理情况"
|
|
|
+ , "出院带药", "出院去向");
|
|
|
+ String text1 = sourceMap.get("出院医嘱");
|
|
|
+ if (text1 != null) {
|
|
|
+ text1.replaceAll("[0-9,、]", "");
|
|
|
+ List<String> sortTitles1 = CommonAnalysisUtil.sortTitles(titles1, text1);
|
|
|
+ CommonAnalysisUtil.cutByTitles(text1, sortTitles1, 0, sourceMap);
|
|
|
+ }
|
|
|
+ sourceMap.put("mode_id=" + contentMap.get("modeId").toString(), "");
|
|
|
+ sourceMap.put("rec_title=" + contentMap.get("recTitle").toString(), "");
|
|
|
|
|
|
- //入院记录标题部分解析不出的 婚姻和民族处理
|
|
|
- //注意中间的空格是什么字符
|
|
|
- List<String> titletitles = Lists.newArrayList("住 址",
|
|
|
- "婚 姻", "民 族", "民 族", "供 史 者", "性 别", "婚 姻", "婚姻状况", "病史提供者");
|
|
|
- for (String str : titletitles) {
|
|
|
- String str1 = str.replaceAll("[ ]", "");
|
|
|
- if (StringUtils.isNotEmpty(sourceMap.get(str))) {
|
|
|
- String value = (sourceMap.get(str).split(" ")[0]).split("\\\\n")[0];
|
|
|
- sourceMap.put(str1, value);
|
|
|
+ //新生儿科姓名+姓名问题解决
|
|
|
+ if (sourceMap.containsKey("姓名")) {
|
|
|
+ String value = sourceMap.get("姓名").split(" ")[0];
|
|
|
+ sourceMap.put("姓名", value);
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(sourceMap.get(str1))) {
|
|
|
- String value = (sourceMap.get(str1).split(" ")[0]).split("\\\\n")[0];
|
|
|
- sourceMap.put(str1, value);
|
|
|
+ //产科孕产次
|
|
|
+ if (sourceMap.containsKey("入院记录")) {
|
|
|
+ String value = sourceMap.get("入院记录").split(" ")[0];
|
|
|
+ sourceMap.put("孕产次", value);
|
|
|
+ }
|
|
|
+ //产科入院记录个人史处理
|
|
|
+ if (sourceMap.containsKey("个人史")) {
|
|
|
+ String value = sourceMap.get("个人史").split("月经史")[0];
|
|
|
+ sourceMap.put("个人史", value);
|
|
|
+ }
|
|
|
+
|
|
|
+ //入院记录标题部分解析不出的 婚姻和民族处理
|
|
|
+ //注意中间的空格是什么字符
|
|
|
+ List<String> titletitles = Lists.newArrayList("住 址",
|
|
|
+ "婚 姻", "民 族", "民 族", "供 史 者", "性 别", "婚 姻", "婚姻状况", "病史提供者");
|
|
|
+ for (String str : titletitles) {
|
|
|
+ String str1 = str.replaceAll("[ ]", "");
|
|
|
+ if (sourceMap.containsKey(str)) {
|
|
|
+ String value = (sourceMap.get(str).split(" ")[0]).split("\\\\n")[0];
|
|
|
+ sourceMap.put(str1, value);
|
|
|
+ }
|
|
|
+ if (sourceMap.containsKey(str1)) {
|
|
|
+ String value = (sourceMap.get(str1).split(" ")[0]).split("\\\\n")[0];
|
|
|
+ sourceMap.put(str1, value);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts, modeId);
|
|
|
OrdinaryAssistant.removeBlank(structureMap);
|
|
|
}
|
|
|
- /*if (StringUtils.isEmpty(structureMap.get("入院时间")) && StringUtils.isNotEmpty(structureMap.get("入病房时间"))) {
|
|
|
- structureMap.put("入院时间", structureMap.get("入病房时间"));
|
|
|
+ //日间病历拼接入院情况
|
|
|
+ if (structureMap.containsKey("现病史") && structureMap.containsKey("既往史")) {
|
|
|
+ structureMap.put("入院情况", structureMap.get("现病史") + structureMap.get("既往史"));
|
|
|
+ } else if (structureMap.containsKey("现病史")) {
|
|
|
+ structureMap.put("入院情况", structureMap.get("现病史"));
|
|
|
+ } else if (structureMap.containsKey("既往史")) {
|
|
|
+ structureMap.put("入院情况", structureMap.get("既往史"));
|
|
|
+ }
|
|
|
+ if (structureMap.containsKey("辅助检查") && structureMap.containsKey("特殊检查")) {
|
|
|
+ structureMap.put("辅助检查", structureMap.get("辅助检查") + "\n" + structureMap.get("特殊检查"));
|
|
|
}
|
|
|
- */
|
|
|
//如果有入院时间,优先使用
|
|
|
addKeyMapping(structureMap, "入院时间", "入病房时间");
|
|
|
//如果有职业,优先使用
|
|
@@ -153,8 +128,10 @@ public class YiWuBeHospitalizedDocTrans extends ModelDocTrans {
|
|
|
return beHospitalizedDoc;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private List<String> keyContrasts = Lists.newArrayList(
|
|
|
+ "初步诊断医师=初步诊断医师签名",
|
|
|
+ "修正诊断医师=修正诊断医师签名",
|
|
|
+ "补充诊断医师=补充诊断医师签名",
|
|
|
"本人姓名=姓名",
|
|
|
"性别=性别",
|
|
|
"年龄=年龄",
|
|
@@ -201,8 +178,7 @@ public class YiWuBeHospitalizedDocTrans extends ModelDocTrans {
|
|
|
"联系地址=户口地址",
|
|
|
"患者工作单位名称=户口地址",
|
|
|
"出生日期时间=出生日期",
|
|
|
- "医师签名=初步诊断医师签名",
|
|
|
- "医生签名=初步诊断医师签名",
|
|
|
+// "医生签名=初步诊断医师签名",
|
|
|
"签字日期=初步诊断日期",
|
|
|
"供史者=病史陈述者",
|
|
|
"无痛人流主诉=主诉",
|
|
@@ -218,7 +194,7 @@ public class YiWuBeHospitalizedDocTrans extends ModelDocTrans {
|
|
|
"有/无=产前检查",
|
|
|
"末次月经日期=末次月经",
|
|
|
"入院诊断1=入院诊断",
|
|
|
- "记录医师=初步诊断医师签名",
|
|
|
+// "记录医师=初步诊断医师签名",
|
|
|
"修正诊断签名日期=修正诊断日期",
|
|
|
"修正诊断一医师签名=修正诊断医师签名",
|
|
|
"患者姓名=姓名",
|
|
@@ -237,11 +213,10 @@ public class YiWuBeHospitalizedDocTrans extends ModelDocTrans {
|
|
|
"患者籍贯=出生地",
|
|
|
"他=其他",
|
|
|
"入院诊断1=初步诊断",
|
|
|
- "入院诊断=初步诊断",
|
|
|
"出院诊断1=出院诊断",
|
|
|
- "主刀医师签名=初步诊断医师签名",
|
|
|
- "brjbxx.lxdh=联系电话",
|
|
|
- "疾病史=既往史",
|
|
|
+ "主刀医师签名=记录医师",
|
|
|
+ "签名医师=记录医师",
|
|
|
+ "时间=记录时间",
|
|
|
"诊断和诊断修正=修正诊断"
|
|
|
);
|
|
|
|
|
@@ -391,14 +366,61 @@ public class YiWuBeHospitalizedDocTrans extends ModelDocTrans {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void modifySignDate(Map<String, String> sourceMap) {
|
|
|
- if (sourceMap.containsKey("医师签名时间")) {
|
|
|
- String signDateStr = sourceMap.get("医师签名时间");
|
|
|
- String[] dateStrArray = signDateStr.split(" ");
|
|
|
- if (dateStrArray.length == 4) {
|
|
|
- sourceMap.put("医师签名时间", dateStrArray[2] + " " + dateStrArray[3]);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 日间病历解析全用切词方式
|
|
|
+ *
|
|
|
+ * @param sourceMap
|
|
|
+ * @param text
|
|
|
+ * @param behDeptId
|
|
|
+ */
|
|
|
+ private void dailyTrans(Map<String, String> sourceMap, String text, String behDeptId) {
|
|
|
+ List<String> titles = Lists.newArrayList();
|
|
|
+ switch (behDeptId) {
|
|
|
+ case "51923":
|
|
|
+ titles = Lists.newArrayList("姓名", "出生日期", "出生地", "其他", "与患者关系", "性别",
|
|
|
+ "年龄", "职业", "入院时间", "婚姻", "出院时间", "民族", "身份证号", "联系电话", "邮政编码",
|
|
|
+ "工作单位", "联系地址", "病史提供者", "病史陈述者", "主诉", "入院情况", "入院诊断", "诊疗情况",
|
|
|
+ "诊疗经过", "出院情况", "出院诊断", "出院医嘱", "医师签名", "记录医师", "主刀医师签名",
|
|
|
+ "记录时间", "时间");
|
|
|
+ break;
|
|
|
+ case "52883":
|
|
|
+ titles = Lists.newArrayList("姓名", "出生日期", "出生地", "其他", "与患者关系", "性别",
|
|
|
+ "年龄", "职业", "入院时间", "婚姻", "出院时间", "民族", "身份证号", "联系电话", "邮政编码",
|
|
|
+ "工作单位", "联系地址", "病史提供者", "病史陈述者", "主诉", "入院情况", "入院诊断", "诊疗情况",
|
|
|
+ "诊疗经过", "出院情况", "出院诊断", "出院医嘱", "注意事项", "出院带药", "随访计划", "医师签名",
|
|
|
+ "记录医师", "记录时间", "时间");
|
|
|
+ break;
|
|
|
+ case "52903":
|
|
|
+ titles = Lists.newArrayList("姓名", "出生日期", "出生地", "其他", "与患者关系", "性别",
|
|
|
+ "年龄", "职业", "入院时间", "婚姻", "出院时间", "民族", "身份证号", "联系电话", "邮政编码",
|
|
|
+ "工作单位", "联系地址", "病史提供者", "病史陈述者", "主诉", "入院情况", "入院诊断", "诊疗情况",
|
|
|
+ "诊疗经过", "出院情况", "出院诊断", "出院医嘱", "注意事项", "出院带药", "随访计划", "医师签名",
|
|
|
+ "记录医师", "记录时间", "时间");
|
|
|
+ break;
|
|
|
+ case "52923":
|
|
|
+ titles = Lists.newArrayList("姓名", "出生日期", "出生地", "其他", "与患者关系", "性别",
|
|
|
+ "年龄", "职业", "入院时间", "婚姻", "出院时间", "民族", "身份证号", "联系电话", "邮政编码",
|
|
|
+ "工作单位", "联系地址", "病史提供者", "病史陈述者", "主诉", "入院情况", "入院诊断", "诊疗情况",
|
|
|
+ "诊疗经过", "出院情况", "出院诊断", "出院医嘱", "注意事项", "出院带药", "随访计划", "医师签名",
|
|
|
+ "记录医师", "记录时间", "时间");
|
|
|
+ break;
|
|
|
+ case "53523":
|
|
|
+ titles = Lists.newArrayList("姓名", "出生日期", "出生地", "其他", "与患者关系", "性别",
|
|
|
+ "年龄", "职业", "入院时间", "婚姻", "出院时间", "民族", "身份证号", "联系电话", "邮政编码",
|
|
|
+ "工作单位", "联系地址", "病史提供者", "病史陈述者", "主诉", "入院情况", "入院诊断", "诊疗情况",
|
|
|
+ "诊疗经过", "出院情况", "出院诊断", "出院医嘱", "注意事项", "出院带药", "随访计划", "医师签名",
|
|
|
+ "记录医师", "记录时间", "时间");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String modifyDiagKey(String text, String key) {
|
|
|
+ if (text.contains(key + ":")) {
|
|
|
+ text = text.replaceFirst("医师签名", key + "医师");
|
|
|
+ text = text.replaceFirst("日 期", key + "日期");
|
|
|
}
|
|
|
+ return text;
|
|
|
}
|
|
|
|
|
|
}
|