|
@@ -1,12 +1,12 @@
|
|
|
package com.lantone.qc.trans.beilun;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
-import com.lantone.qc.pub.model.doc.DeathRecordDoc;
|
|
|
import com.lantone.qc.pub.model.doc.InformedConsentDoc;
|
|
|
import com.lantone.qc.pub.model.vo.MedrecVo;
|
|
|
import com.lantone.qc.pub.util.FastJsonUtils;
|
|
|
+import com.lantone.qc.pub.util.ListUtil;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
import com.lantone.qc.trans.ModelDocTrans;
|
|
|
-import com.lantone.qc.trans.beilun.util.BeiLunDeathRecordHtmlAnalysis;
|
|
|
import com.lantone.qc.trans.beilun.util.BeiLunHtmlAnalysis;
|
|
|
import com.lantone.qc.trans.beilun.util.BeiLunInformedHtmlAnalysis;
|
|
|
import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
|
|
@@ -14,6 +14,7 @@ import com.lantone.qc.trans.comsis.ModelDocGenerate;
|
|
|
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;
|
|
|
|
|
@@ -25,48 +26,65 @@ import java.util.Map;
|
|
|
@Slf4j
|
|
|
public class BeilunInformedConsentDocTrans extends ModelDocTrans {
|
|
|
@Override
|
|
|
- public InformedConsentDoc extract(MedrecVo medrecVo) {
|
|
|
-// InformedConsentDoc informedConsentDoc = new InformedConsentDoc();
|
|
|
-// Map<String, Object> content = medrecVo.getContent();
|
|
|
-// if(content .size()>0){
|
|
|
-// Map<String, String> structureMap = informedConsentDoc.getStructureMap();
|
|
|
-// content.forEach((key,value)-> structureMap.put(key,value.toString()));
|
|
|
-// }
|
|
|
- InformedConsentDoc informedConsentDoc = null;
|
|
|
- try {
|
|
|
- Map<String, Object> contentMap = ((List<Map>) medrecVo.getContent().get("content")).get(0);
|
|
|
- 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 BeiLunInformedHtmlAnalysis();
|
|
|
- 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());
|
|
|
- }
|
|
|
+ public List<InformedConsentDoc> extract(MedrecVo medrecVo) {
|
|
|
+ List<InformedConsentDoc> retList = Lists.newArrayList();
|
|
|
+ Map<String, List<String>> contentMap = (Map) medrecVo.getContent().get("content");
|
|
|
+ if (contentMap == null) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+ for (Map.Entry<String, List<String>> entry : contentMap.entrySet()) {
|
|
|
+ InformedConsentDoc informedConsentDoc = getInformedConsentDoc((List) entry.getValue());
|
|
|
+ retList.add(informedConsentDoc);
|
|
|
+ }
|
|
|
+ return retList;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private InformedConsentDoc getInformedConsentDoc(List<Map<String, Object>> contentMaps) {
|
|
|
+ InformedConsentDoc informedConsentDoc = new InformedConsentDoc();
|
|
|
+ if (ListUtil.isEmpty(contentMaps)) {
|
|
|
+ return informedConsentDoc;
|
|
|
+ }
|
|
|
+ for (Map<String, Object> contentMap : contentMaps) {
|
|
|
+ if (contentMap.get("xmlText") == null || StringUtil.isBlank(contentMap.get("xmlText").toString())) {
|
|
|
+ continue;
|
|
|
}
|
|
|
- if (MapUtils.isNotEmpty(structureMap)) {
|
|
|
- informedConsentDoc = ModelDocGenerate.informedConsentDocGen(structureMap);
|
|
|
- informedConsentDoc.setText(CommonAnalysisUtil.html2String(content));
|
|
|
- informedConsentDoc.setPageData((Map) structureMap);
|
|
|
+ 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 BeiLunInformedHtmlAnalysis();
|
|
|
+ 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)) {
|
|
|
+ informedConsentDoc = ModelDocGenerate.informedConsentDocGen(structureMap);
|
|
|
+ informedConsentDoc.setText(CommonAnalysisUtil.html2String(content));
|
|
|
+ informedConsentDoc.setPageData((Map) structureMap);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
}
|
|
|
return informedConsentDoc;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private List<String> keyContrasts = Lists.newArrayList(
|
|
|
"患者签名=患方签名",
|
|
|
"患方手写意见=患方签名",
|
|
|
"患方手写意见患方签名=患方签名",
|
|
|
"患方或受托代理人签名=患方或受托代理人签名",
|
|
|
- "代理人签名=被授权人签名",
|
|
|
+ "代理人签名=被授权人签名",
|
|
|
"被授权人签名=被授权人签名"
|
|
|
);
|
|
|
}
|