|
@@ -1,10 +1,11 @@
|
|
package com.lantone.qc.trans.changx;
|
|
package com.lantone.qc.trans.changx;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
+import com.google.common.collect.Maps;
|
|
|
|
+import com.google.common.collect.Sets;
|
|
import com.lantone.qc.pub.model.doc.transferrecord.TransferIntoDoc;
|
|
import com.lantone.qc.pub.model.doc.transferrecord.TransferIntoDoc;
|
|
import com.lantone.qc.pub.model.doc.transferrecord.TransferOutDoc;
|
|
import com.lantone.qc.pub.model.doc.transferrecord.TransferOutDoc;
|
|
import com.lantone.qc.pub.model.doc.transferrecord.TransferRecordDoc;
|
|
import com.lantone.qc.pub.model.doc.transferrecord.TransferRecordDoc;
|
|
-import com.lantone.qc.pub.model.keys.ModelStandardKeys;
|
|
|
|
import com.lantone.qc.pub.model.vo.MedrecVo;
|
|
import com.lantone.qc.pub.model.vo.MedrecVo;
|
|
import com.lantone.qc.pub.util.ListUtil;
|
|
import com.lantone.qc.pub.util.ListUtil;
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
@@ -14,6 +15,7 @@ import com.lantone.qc.trans.comsis.Preproc;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.Set;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 转科记录文档生成
|
|
* @Description: 转科记录文档生成
|
|
@@ -25,46 +27,162 @@ public class ChangxTransferRecordDocTrans extends ModelDocTrans {
|
|
@Override
|
|
@Override
|
|
public List<TransferRecordDoc> extract(MedrecVo medrecVo) {
|
|
public List<TransferRecordDoc> extract(MedrecVo medrecVo) {
|
|
List<TransferRecordDoc> retList = Lists.newArrayList();
|
|
List<TransferRecordDoc> retList = Lists.newArrayList();
|
|
- Map<String, Object> content = medrecVo.getContent();
|
|
|
|
- Map<String, List<String>> labelMap = (Map) content.get("label");
|
|
|
|
- List<String> transferIntoLabel = labelMap.get("转入");
|
|
|
|
- List<String> transferOutLabel = labelMap.get("转出");
|
|
|
|
- List<Map<String, String>> transferRecords = (List) content.get("content");
|
|
|
|
-
|
|
|
|
- String transferIntoContent, transferOutContent;
|
|
|
|
- Map<String, String> transferIntoStructureMap, transferOutStructureMap;
|
|
|
|
- for (Map<String, String> transferRecord : transferRecords) {
|
|
|
|
|
|
+
|
|
|
|
+ Map<String, List<String>> contentMap = (Map) medrecVo.getContent().get("content");
|
|
|
|
+ if (contentMap == null) {
|
|
|
|
+ return retList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String, TransferIntoDoc> transferIntoDocMap = getTransferIntoDocMap(contentMap.get("转入"));
|
|
|
|
+ Map<String, TransferOutDoc> transferOutDocMap = getTransferOutDocMap(contentMap.get("转出"));
|
|
|
|
+
|
|
|
|
+ Set<String> transferRecordNameSet = Sets.newHashSet();
|
|
|
|
+ transferRecordNameSet.addAll(transferIntoDocMap.keySet());
|
|
|
|
+ transferRecordNameSet.addAll(transferOutDocMap.keySet());
|
|
|
|
+
|
|
|
|
+ transferRecordNameSet.forEach(transferRecordName -> {
|
|
TransferRecordDoc transferRecordDoc = new TransferRecordDoc();
|
|
TransferRecordDoc transferRecordDoc = new TransferRecordDoc();
|
|
|
|
+ transferRecordDoc.setTransferRecordName(transferRecordName);
|
|
|
|
+ transferRecordDoc.setTransferIntoDoc(transferIntoDocMap.get(transferRecordName));
|
|
|
|
+ transferRecordDoc.setTransferOutDoc(transferOutDocMap.get(transferRecordName));
|
|
|
|
+ retList.add(transferRecordDoc);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return retList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
- transferIntoContent = transferRecord.get("转入");
|
|
|
|
- if (StringUtil.isNotBlank(transferIntoContent)) {
|
|
|
|
- transferIntoStructureMap =
|
|
|
|
- Preproc.extract_doc_pub(
|
|
|
|
- false,
|
|
|
|
- ListUtil.isEmpty(transferIntoLabel) ? ModelStandardKeys.transferInto : transferIntoLabel,
|
|
|
|
- transferIntoContent
|
|
|
|
- );
|
|
|
|
- TransferIntoDoc transferIntoDoc = ModelDocGenerate.transferIntoDocGen(transferIntoStructureMap);
|
|
|
|
- transferIntoDoc.setText(transferIntoContent);
|
|
|
|
- transferRecordDoc.setTransferIntoDoc(transferIntoDoc);
|
|
|
|
|
|
+ /**************************************************转入*******************************************************/
|
|
|
|
+ private Map<String, TransferIntoDoc> getTransferIntoDocMap(List<String> contents) {
|
|
|
|
+ Map<String, TransferIntoDoc> retMap = Maps.newHashMap();
|
|
|
|
+ if (ListUtil.isEmpty(contents)) {
|
|
|
|
+ return retMap;
|
|
|
|
+ }
|
|
|
|
+ int index = 1;
|
|
|
|
+ String transferRecordName = null;
|
|
|
|
+ for (String content : contents) {
|
|
|
|
+ if (StringUtil.isBlank(content)) {
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
|
|
+ transferRecordName = index + "";
|
|
|
|
+ TransferIntoDoc transferIntoDoc = getTransferIntoDoc(content);
|
|
|
|
+ transferIntoDoc.setTransferRecordName(transferRecordName);
|
|
|
|
+ retMap.put(transferRecordName, transferIntoDoc);
|
|
|
|
+ index++;
|
|
|
|
+ }
|
|
|
|
+ return retMap;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private TransferIntoDoc getTransferIntoDoc(String content) {
|
|
|
|
+ Map<String, String> pageData = Preproc.extract_doc_pub(true, transferInto_pageDataTitles, content);
|
|
|
|
+ pageData.put("病程记录内容",
|
|
|
|
+ pageData.get("病程记录内容")
|
|
|
|
+ .replace(pageData.get("病程记录时间"), "")
|
|
|
|
+ .replace(pageData.get("病程记录名称"), "")
|
|
|
|
+ );
|
|
|
|
|
|
- transferOutContent = transferRecord.get("转出");
|
|
|
|
- if (StringUtil.isNotBlank(transferOutContent)) {
|
|
|
|
- transferOutStructureMap =
|
|
|
|
- Preproc.extract_doc_pub(
|
|
|
|
- false,
|
|
|
|
- ListUtil.isEmpty(transferOutLabel) ? ModelStandardKeys.transferOut : transferOutLabel,
|
|
|
|
- transferOutContent
|
|
|
|
- );
|
|
|
|
- TransferOutDoc transferOutDoc = ModelDocGenerate.transferOutDocGen(transferOutStructureMap);
|
|
|
|
- transferOutDoc.setText(transferOutContent);
|
|
|
|
- transferRecordDoc.setTransferOutDoc(transferOutDoc);
|
|
|
|
|
|
+ List<String> targetTitles = Lists.newArrayList();
|
|
|
|
+ transferInto_sourceTitles.forEach(sourceTitle -> {
|
|
|
|
+ String targetTitle = "";
|
|
|
|
+ for (int index = 0; index < sourceTitle.length(); index++) {
|
|
|
|
+ if (index == sourceTitle.length() - 1) {
|
|
|
|
+ targetTitle += sourceTitle.substring(index, index + 1);
|
|
|
|
+ } else {
|
|
|
|
+ targetTitle += sourceTitle.substring(index, index + 1) + "[\\s\\p{Zs}]*";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ targetTitles.add(targetTitle);
|
|
|
|
+ });
|
|
|
|
|
|
- retList.add(transferRecordDoc);
|
|
|
|
|
|
+ Map<String, String> sourceMap = Preproc.extract_doc_pub(true, targetTitles, content);
|
|
|
|
+ sourceMap.put("记录时间", sourceMap.get("病程记录时间"));
|
|
|
|
+
|
|
|
|
+ TransferIntoDoc transferIntoDoc = ModelDocGenerate.transferIntoDocGen(sourceMap);
|
|
|
|
+ transferIntoDoc.setText(content);
|
|
|
|
+ transferIntoDoc.setPageData((Map) pageData);
|
|
|
|
+
|
|
|
|
+ return transferIntoDoc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<String> transferInto_pageDataTitles = Lists.newArrayList(
|
|
|
|
+ "病程记录时间",
|
|
|
|
+ "病程记录名称",
|
|
|
|
+ "病程记录内容",
|
|
|
|
+ "记录医师"
|
|
|
|
+ );
|
|
|
|
+ private List<String> transferInto_sourceTitles = Lists.newArrayList(
|
|
|
|
+ "病程记录时间",
|
|
|
|
+ "病程记录名称",
|
|
|
|
+ "病程记录内容",
|
|
|
|
+ "记录时间",
|
|
|
|
+ "记录医师"
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**************************************************转出*******************************************************/
|
|
|
|
+ private Map<String, TransferOutDoc> getTransferOutDocMap(List<String> contents) {
|
|
|
|
+ Map<String, TransferOutDoc> retMap = Maps.newHashMap();
|
|
|
|
+ if (ListUtil.isEmpty(contents)) {
|
|
|
|
+ return retMap;
|
|
}
|
|
}
|
|
- return retList;
|
|
|
|
|
|
+ int index = 1;
|
|
|
|
+ String transferRecordName = null;
|
|
|
|
+ for (String content : contents) {
|
|
|
|
+ if (StringUtil.isBlank(content)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ transferRecordName = index + "";
|
|
|
|
+ TransferOutDoc transferOutDoc = getTransferOutDoc(content);
|
|
|
|
+ transferOutDoc.setTransferRecordName(transferRecordName);
|
|
|
|
+ retMap.put(transferRecordName, transferOutDoc);
|
|
|
|
+ index++;
|
|
|
|
+ }
|
|
|
|
+ return retMap;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private TransferOutDoc getTransferOutDoc(String content) {
|
|
|
|
+ Map<String, String> pageData = Preproc.extract_doc_pub(true, transferOut_pageDataTitles, content);
|
|
|
|
+ pageData.put("病程记录内容",
|
|
|
|
+ pageData.get("病程记录内容")
|
|
|
|
+ .replace(pageData.get("病程记录时间"), "")
|
|
|
|
+ .replace(pageData.get("病程记录名称"), "")
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ List<String> targetTitles = Lists.newArrayList();
|
|
|
|
+ transferOut_sourceTitles.forEach(sourceTitle -> {
|
|
|
|
+ String targetTitle = "";
|
|
|
|
+ for (int index = 0; index < sourceTitle.length(); index++) {
|
|
|
|
+ if (index == sourceTitle.length() - 1) {
|
|
|
|
+ targetTitle += sourceTitle.substring(index, index + 1);
|
|
|
|
+ } else {
|
|
|
|
+ targetTitle += sourceTitle.substring(index, index + 1) + "[\\s\\p{Zs}]*";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ targetTitles.add(targetTitle);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ Map<String, String> sourceMap = Preproc.extract_doc_pub(true, targetTitles, content);
|
|
|
|
+ sourceMap.put("记录时间", sourceMap.get("病程记录时间"));
|
|
|
|
+
|
|
|
|
+ TransferOutDoc transferOutDoc = ModelDocGenerate.transferOutDocGen(sourceMap);
|
|
|
|
+ transferOutDoc.setText(content);
|
|
|
|
+ transferOutDoc.setPageData((Map) pageData);
|
|
|
|
+
|
|
|
|
+ return transferOutDoc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<String> transferOut_pageDataTitles = Lists.newArrayList(
|
|
|
|
+ "病程记录时间",
|
|
|
|
+ "病程记录名称",
|
|
|
|
+ "病程记录内容",
|
|
|
|
+ "记录医师"
|
|
|
|
+ );
|
|
|
|
+ private List<String> transferOut_sourceTitles = Lists.newArrayList(
|
|
|
|
+ "病程记录时间",
|
|
|
|
+ "病程记录名称",
|
|
|
|
+ "病程记录内容",
|
|
|
|
+ "记录时间",
|
|
|
|
+ "记录医师"
|
|
|
|
+ );
|
|
|
|
+
|
|
}
|
|
}
|