|
@@ -0,0 +1,140 @@
|
|
|
+package com.lantone.qc.trans.taizhou;
|
|
|
+
|
|
|
+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.consultation.ConsultationApplicationDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.consultation.ConsultationDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.consultation.ConsultationRecordDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.consultation.ConsultationResultsDoc;
|
|
|
+import com.lantone.qc.pub.model.vo.MedrecVo;
|
|
|
+import com.lantone.qc.pub.util.ListUtil;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import com.lantone.qc.trans.ModelDocTrans;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: 会诊文档生成
|
|
|
+ * @author: rengb
|
|
|
+ * @time: 2020/3/17 13:22
|
|
|
+ */
|
|
|
+public class TaiZhouConsultationDocTrans extends ModelDocTrans {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ConsultationDoc> extract(MedrecVo medrecVo) {
|
|
|
+ List<ConsultationDoc> retList = Lists.newArrayList();
|
|
|
+
|
|
|
+ Map<String, List<String>> contentMap = (Map) medrecVo.getContent().get("content");
|
|
|
+ if (contentMap == null) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, ConsultationRecordDoc> consultationRecordDocMap = getConsultationRecordDocMap(contentMap.get("会诊记录"));
|
|
|
+ Map<String, ConsultationResultsDoc> consultationResultsDocMap = getConsultationResultsDocMap(contentMap.get("会诊结果单"));
|
|
|
+ Map<String, ConsultationApplicationDoc> consultationApplicationDocMap = getConsultationApplicationDocMap(contentMap.get("会诊申请单"));
|
|
|
+
|
|
|
+ Set<String> consultationNameSet = Sets.newHashSet();
|
|
|
+ consultationNameSet.addAll(consultationRecordDocMap.keySet());
|
|
|
+ consultationNameSet.addAll(consultationResultsDocMap.keySet());
|
|
|
+ consultationNameSet.addAll(consultationApplicationDocMap.keySet());
|
|
|
+
|
|
|
+ consultationNameSet.forEach(consultationName -> {
|
|
|
+ ConsultationDoc consultationDoc = new ConsultationDoc();
|
|
|
+ consultationDoc.setConsultationName(consultationName);
|
|
|
+ consultationDoc.setConsultationRecordDoc(consultationRecordDocMap.get(consultationName));
|
|
|
+ consultationDoc.setConsultationResultsDoc(consultationResultsDocMap.get(consultationName));
|
|
|
+ consultationDoc.setConsultationApplicationDoc(consultationApplicationDocMap.get(consultationName));
|
|
|
+ retList.add(consultationDoc);
|
|
|
+ });
|
|
|
+
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**************************************************会诊记录*********************************************************/
|
|
|
+ private Map<String, ConsultationRecordDoc> getConsultationRecordDocMap(List<String> contents) {
|
|
|
+ Map<String, ConsultationRecordDoc> retMap = Maps.newHashMap();
|
|
|
+ if (ListUtil.isEmpty(contents)) {
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ int index = 1;
|
|
|
+ String consultationName = null;
|
|
|
+ for (String content : contents) {
|
|
|
+ if (StringUtil.isBlank(content)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ consultationName = index + "";
|
|
|
+ ConsultationRecordDoc consultationRecordDoc = getConsultationRecordDoc(content);
|
|
|
+ consultationRecordDoc.setConsultationName(consultationName);
|
|
|
+ retMap.put(consultationName, consultationRecordDoc);
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ConsultationRecordDoc getConsultationRecordDoc(String content) {
|
|
|
+ ConsultationRecordDoc consultationRecordDoc = new ConsultationRecordDoc();
|
|
|
+
|
|
|
+ return consultationRecordDoc;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**************************************************会诊结果单*******************************************************/
|
|
|
+ private Map<String, ConsultationResultsDoc> getConsultationResultsDocMap(List<String> contents) {
|
|
|
+ Map<String, ConsultationResultsDoc> retMap = Maps.newHashMap();
|
|
|
+ if (ListUtil.isEmpty(contents)) {
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ int index = 1;
|
|
|
+ String consultationName = null;
|
|
|
+ for (String content : contents) {
|
|
|
+ if (StringUtil.isBlank(content)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ consultationName = index + "";
|
|
|
+ ConsultationResultsDoc consultationResultsDoc = getConsultationResultsDoc(content);
|
|
|
+ consultationResultsDoc.setConsultationName(consultationName);
|
|
|
+ retMap.put(consultationName, consultationResultsDoc);
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ConsultationResultsDoc getConsultationResultsDoc(String content) {
|
|
|
+ ConsultationResultsDoc consultationResultsDoc = new ConsultationResultsDoc();
|
|
|
+
|
|
|
+ return consultationResultsDoc;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**************************************************会诊申请单*******************************************************/
|
|
|
+ private Map<String, ConsultationApplicationDoc> getConsultationApplicationDocMap(List<String> contents) {
|
|
|
+ Map<String, ConsultationApplicationDoc> retMap = Maps.newHashMap();
|
|
|
+ if (ListUtil.isEmpty(contents)) {
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ int index = 1;
|
|
|
+ String consultationName = null;
|
|
|
+ for (String content : contents) {
|
|
|
+ if (StringUtil.isBlank(content)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ consultationName = index + "";
|
|
|
+ ConsultationApplicationDoc consultationApplicationDoc = getConsultationApplicationDoc(content);
|
|
|
+ consultationApplicationDoc.setConsultationName(consultationName);
|
|
|
+ retMap.put(consultationName, consultationApplicationDoc);
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ConsultationApplicationDoc getConsultationApplicationDoc(String content) {
|
|
|
+ ConsultationApplicationDoc consultationApplicationDoc = new ConsultationApplicationDoc();
|
|
|
+
|
|
|
+ return consultationApplicationDoc;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|