|
@@ -1,9 +1,20 @@
|
|
|
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.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;
|
|
|
+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;
|
|
|
|
|
|
/**
|
|
@@ -11,15 +22,51 @@ import java.util.Map;
|
|
|
* @author: cy
|
|
|
* @time: 2021/4/18 17:48
|
|
|
*/
|
|
|
+@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 = 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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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);
|
|
|
}
|
|
|
return informedConsentDoc;
|
|
|
}
|
|
|
+
|
|
|
+ private List<String> keyContrasts = Lists.newArrayList(
|
|
|
+ "患者签名=患方签名",
|
|
|
+ "患方手写意见=患方签名",
|
|
|
+ "患方手写意见患方签名=患方签名",
|
|
|
+ "患方或受托代理人签名=患方或受托代理人签名",
|
|
|
+ "代理人签名=被授权人签名",
|
|
|
+ "被授权人签名=被授权人签名"
|
|
|
+ );
|
|
|
}
|