|
@@ -22,12 +22,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.regex.Matcher;
|
|
|
-import java.util.regex.Pattern;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @Description: 查房记录文档生成
|
|
@@ -39,6 +34,7 @@ import java.util.regex.Pattern;
|
|
|
public class BeiLunThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
|
|
|
private List<OperationDoc> operationDocs;
|
|
|
+ private List<String> containList = Arrays.asList("查房", "主任", "主治", "主刀", "日常病程", "病程记录", "术后第");
|
|
|
|
|
|
@Override
|
|
|
public List<ThreeLevelWardDoc> extract(MedrecVo medrecVo) {
|
|
@@ -57,77 +53,88 @@ public class BeiLunThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
}
|
|
|
|
|
|
private void classifyThreeLevelWardDoc(ThreeLevelWardDoc threeLevelWardDoc, Map<String, Object> contentMap) {
|
|
|
- String content = contentMap.get("xmlText").toString();
|
|
|
- Map<String, String> structureMap = null;
|
|
|
- if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
|
|
|
- structureMap = (Map) FastJsonUtils.getJsonToMap(content);
|
|
|
- } else {
|
|
|
- String recTitle = contentMap.get("recTitle").toString();
|
|
|
- String recTypeId = contentMap.get("recTypeId").toString();
|
|
|
- BeiLunHtmlAnalysis beiLunHtmlAnalysis = new BeiLunThreeLevelWardHtmlAnalysis();
|
|
|
- Map<String, String> sourceMap = beiLunHtmlAnalysis.analysis(content, recTitle, recTypeId);
|
|
|
- if (MapUtils.isNotEmpty(sourceMap)) {
|
|
|
- structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
|
|
|
- structureMap.put("记录编号", contentMap.get("recId").toString());
|
|
|
- structureMap.put("病历号", contentMap.get("behospitalCode") == null ? null : contentMap.get("behospitalCode").toString());
|
|
|
+ if (contentMap.get("recTitle") != null && StringUtil.isNotBlank(contentMap.get("recTitle").toString())) {
|
|
|
+ boolean flag = false;
|
|
|
+ for (String word : containList) {
|
|
|
+ if (contentMap.get("recTitle").toString().contains(word)) {
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (MapUtils.isEmpty(structureMap)) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (flag) {
|
|
|
+ String content = contentMap.get("xmlText").toString();
|
|
|
+ Map<String, String> structureMap = null;
|
|
|
+ if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
|
|
|
+ structureMap = (Map) FastJsonUtils.getJsonToMap(content);
|
|
|
+ } else {
|
|
|
+ String recTitle = contentMap.get("recTitle").toString();
|
|
|
+ String recTypeId = contentMap.get("recTypeId").toString();
|
|
|
+ BeiLunHtmlAnalysis beiLunHtmlAnalysis = new BeiLunThreeLevelWardHtmlAnalysis();
|
|
|
+ Map<String, String> sourceMap = beiLunHtmlAnalysis.analysis(content, recTitle, recTypeId);
|
|
|
+ if (MapUtils.isNotEmpty(sourceMap)) {
|
|
|
+ structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
|
|
|
+ structureMap.put("记录编号", contentMap.get("recId").toString());
|
|
|
+ structureMap.put("病历号", contentMap.get("behospitalCode") == null ? null : contentMap.get("behospitalCode").toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (MapUtils.isEmpty(structureMap)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- if (structureMap.containsKey("病情记录")) {
|
|
|
- structureMap.put("病情记录", structureMap.get("病情记录").replace(" ", ""));
|
|
|
- }
|
|
|
- //structureMap.put("查房日期", structureMap.get("记录时间"));
|
|
|
+ if (structureMap.containsKey("病情记录")) {
|
|
|
+ structureMap.put("病情记录", structureMap.get("病情记录").replace(" ", ""));
|
|
|
+ }
|
|
|
+ //structureMap.put("查房日期", structureMap.get("记录时间"));
|
|
|
|
|
|
- /*Map<String, String> cutWordMap = Maps.newHashMap();
|
|
|
- String text = CxXmlUtil.getXmlText(content);
|
|
|
- if (StringUtil.isNotBlank(text)) {
|
|
|
- if (StringUtil.isBlank(structureMap.get("病情记录"))) {
|
|
|
- structureMap.put("病情记录", text);
|
|
|
- }
|
|
|
- cutWordMap = Preproc.getCutWordMap(true, sourceTitles, text);
|
|
|
- if (StringUtil.isBlank(structureMap.get("记录医师"))) {
|
|
|
- Pattern p = Pattern.compile("^[^\\u4e00-\\u9fa5]+$");//分词结果如果不包含中文为日期,则不覆盖
|
|
|
- if (StringUtil.isNotEmpty(cutWordMap.get("医师签名"))) {
|
|
|
- Matcher m = p.matcher(cutWordMap.get("医师签名"));
|
|
|
- if (!m.matches()) {
|
|
|
- structureMap.put("记录医师", cutWordMap.get("医师签名"));
|
|
|
+ /*Map<String, String> cutWordMap = Maps.newHashMap();
|
|
|
+ String text = CxXmlUtil.getXmlText(content);
|
|
|
+ if (StringUtil.isNotBlank(text)) {
|
|
|
+ if (StringUtil.isBlank(structureMap.get("病情记录"))) {
|
|
|
+ structureMap.put("病情记录", text);
|
|
|
}
|
|
|
- }
|
|
|
- if (StringUtil.isNotEmpty(cutWordMap.get("记录医生"))) {
|
|
|
- Matcher m = p.matcher(cutWordMap.get("记录医生"));
|
|
|
- if (!m.matches()) {
|
|
|
- structureMap.put("记录医师", cutWordMap.get("记录医生"));
|
|
|
+ cutWordMap = Preproc.getCutWordMap(true, sourceTitles, text);
|
|
|
+ if (StringUtil.isBlank(structureMap.get("记录医师"))) {
|
|
|
+ Pattern p = Pattern.compile("^[^\\u4e00-\\u9fa5]+$");//分词结果如果不包含中文为日期,则不覆盖
|
|
|
+ if (StringUtil.isNotEmpty(cutWordMap.get("医师签名"))) {
|
|
|
+ Matcher m = p.matcher(cutWordMap.get("医师签名"));
|
|
|
+ if (!m.matches()) {
|
|
|
+ structureMap.put("记录医师", cutWordMap.get("医师签名"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotEmpty(cutWordMap.get("记录医生"))) {
|
|
|
+ Matcher m = p.matcher(cutWordMap.get("记录医生"));
|
|
|
+ if (!m.matches()) {
|
|
|
+ structureMap.put("记录医师", cutWordMap.get("记录医生"));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- */
|
|
|
+ */
|
|
|
|
|
|
- //总的查房记录 汇总
|
|
|
- ThreeLevelWardDoc allDoctorWradDoc = new ThreeLevelWardDoc();
|
|
|
- allDoctorWradDoc.setStructureMap(structureMap);
|
|
|
- allDoctorWradDoc.setPageData((Map) structureMap);
|
|
|
- threeLevelWardDoc.addAllDoctorWradDoc(allDoctorWradDoc);
|
|
|
+ //总的查房记录 汇总
|
|
|
+ ThreeLevelWardDoc allDoctorWradDoc = new ThreeLevelWardDoc();
|
|
|
+ allDoctorWradDoc.setStructureMap(structureMap);
|
|
|
+ allDoctorWradDoc.setPageData((Map) structureMap);
|
|
|
+ threeLevelWardDoc.addAllDoctorWradDoc(allDoctorWradDoc);
|
|
|
|
|
|
- //主任医师查房
|
|
|
- DirectorDoctorWardDoc directorDoctorWardDoc = findDirectorDoctorWardDoc(structureMap);
|
|
|
- if (directorDoctorWardDoc != null) {
|
|
|
- threeLevelWardDoc.addDirectorDoctorWardDoc(findDirectorDoctorWardDoc(structureMap));
|
|
|
- }
|
|
|
- //主治医师查房
|
|
|
- AttendingDoctorWardDoc attendingDoctorWardDoc = findAttendingDoctorWardDoc(structureMap);
|
|
|
- if (attendingDoctorWardDoc != null) {
|
|
|
- threeLevelWardDoc.addAttendingDoctorWardDoc(attendingDoctorWardDoc);
|
|
|
- }
|
|
|
- //普通医师查房
|
|
|
- if (directorDoctorWardDoc == null && attendingDoctorWardDoc == null) {
|
|
|
- GeneralDoctorWardDoc generalDoctorWardDoc = new GeneralDoctorWardDoc();
|
|
|
- generalDoctorWardDoc.setStructureMap(structureMap);
|
|
|
- generalDoctorWardDoc.setPageData((Map) structureMap);
|
|
|
- threeLevelWardDoc.addGeneralDoctorWardDoc(generalDoctorWardDoc);
|
|
|
+ //主任医师查房
|
|
|
+ DirectorDoctorWardDoc directorDoctorWardDoc = findDirectorDoctorWardDoc(structureMap);
|
|
|
+ if (directorDoctorWardDoc != null) {
|
|
|
+ threeLevelWardDoc.addDirectorDoctorWardDoc(findDirectorDoctorWardDoc(structureMap));
|
|
|
+ }
|
|
|
+ //主治医师查房
|
|
|
+ AttendingDoctorWardDoc attendingDoctorWardDoc = findAttendingDoctorWardDoc(structureMap);
|
|
|
+ if (attendingDoctorWardDoc != null) {
|
|
|
+ threeLevelWardDoc.addAttendingDoctorWardDoc(attendingDoctorWardDoc);
|
|
|
+ }
|
|
|
+ //普通医师查房
|
|
|
+ if (directorDoctorWardDoc == null && attendingDoctorWardDoc == null) {
|
|
|
+ GeneralDoctorWardDoc generalDoctorWardDoc = new GeneralDoctorWardDoc();
|
|
|
+ generalDoctorWardDoc.setStructureMap(structureMap);
|
|
|
+ generalDoctorWardDoc.setPageData((Map) structureMap);
|
|
|
+ threeLevelWardDoc.addGeneralDoctorWardDoc(generalDoctorWardDoc);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -253,13 +260,6 @@ public class BeiLunThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
director = content.substring(0, content.indexOf(","));
|
|
|
}
|
|
|
return director.contains("主治");
|
|
|
-// Pattern p = Pattern.compile("(?<=主治医师).+?(?=住院医师)");
|
|
|
-// Matcher m = p.matcher(content);
|
|
|
-// String result = "";
|
|
|
-// while (m.find()) {
|
|
|
-// result = m.group().trim();
|
|
|
-// }
|
|
|
-// return StringUtil.isNotEmpty(result.replace(":", "").replace(":", ""));
|
|
|
}
|
|
|
|
|
|
private String subTitle(String srcText) {
|