|
@@ -0,0 +1,79 @@
|
|
|
+package com.lantone.qc.trans.beilun;
|
|
|
+
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.lantone.qc.pub.model.doc.InvasiveOperationDoc;
|
|
|
+import com.lantone.qc.pub.model.vo.MedrecVo;
|
|
|
+import com.lantone.qc.pub.util.FastJsonUtils;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import com.lantone.qc.trans.ModelDocTrans;
|
|
|
+import com.lantone.qc.trans.beilun.util.BeiLunHtmlAnalysis;
|
|
|
+import com.lantone.qc.trans.beilun.util.BeiLunInvasiveOperationHtmlAnalysis;
|
|
|
+import com.lantone.qc.trans.comsis.OrdinaryAssistant;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections.MapUtils;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: 有创操作
|
|
|
+ * @author: cy
|
|
|
+ * @time: 2021/8/27 16:12
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+public class BeilunInvasiveOperationDocTrans extends ModelDocTrans {
|
|
|
+ @Override
|
|
|
+ public List<InvasiveOperationDoc> extract(MedrecVo medrecVo) {
|
|
|
+ List<InvasiveOperationDoc> retList = Lists.newArrayList();
|
|
|
+ List<Map<String, Object>> contentMaps = (List) medrecVo.getContent().get("content");
|
|
|
+ contentMaps.forEach(contentMap -> {
|
|
|
+ retList.add(getInvasiveOperationDoc(contentMap));
|
|
|
+ });
|
|
|
+ return retList;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private InvasiveOperationDoc getInvasiveOperationDoc(Map<String, Object> contentMap) {
|
|
|
+ InvasiveOperationDoc invasiveOperationDoc = new InvasiveOperationDoc();
|
|
|
+ if (MapUtils.isEmpty(contentMap)) {
|
|
|
+ return invasiveOperationDoc;
|
|
|
+ }
|
|
|
+ if(contentMap.get("htmlText") == null && contentMap.get("xmlText") != null){
|
|
|
+ contentMap.put("xmlText",contentMap.get("xmlText"));
|
|
|
+ }
|
|
|
+ if (contentMap.get("xmlText") == null || StringUtil.isBlank(contentMap.get("xmlText").toString())) {
|
|
|
+ return invasiveOperationDoc;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ 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 BeiLunInvasiveOperationHtmlAnalysis();
|
|
|
+ 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("标题", recTitle);
|
|
|
+ structureMap.put("病历号", contentMap.get("behospitalCode") == null ? null : contentMap.get("behospitalCode").toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (MapUtils.isNotEmpty(structureMap)) {
|
|
|
+ invasiveOperationDoc.setStructureMap(structureMap);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
+ return invasiveOperationDoc;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private List<String> keyContrasts = Lists.newArrayList(
|
|
|
+ "操作简要经过(包括术中有无并发症及具体描述和处理)=操作步骤",
|
|
|
+ "术后注意事项=术后注意"
|
|
|
+ );
|
|
|
+}
|