package com.lantone.qc.trans.taizhou;

import com.google.common.collect.Lists;
import com.lantone.qc.pub.model.doc.DifficultCaseDiscussDoc;
import com.lantone.qc.pub.model.vo.MedrecVo;
import com.lantone.qc.trans.ModelDocTrans;
import com.lantone.qc.trans.comsis.OrdinaryAssistant;
import com.lantone.qc.trans.taizhou.util.TzXmlUtil;

import java.util.List;
import java.util.Map;

/**
 * @Description: 疑难病例讨论记录文档生成
 * @author: rengb
 * @time: 2020/3/17 13:23
 */
public class TaiZhouDifficultCaseDiscussDocTrans extends ModelDocTrans {

    @Override
    public List<DifficultCaseDiscussDoc> extract(MedrecVo medrecVo) {
        List<DifficultCaseDiscussDoc> retList = Lists.newArrayList();
        List<String> contents = (List) medrecVo.getContent().get("content");
        contents.forEach(content -> {
            retList.add(getDifficultCaseDiscussDoc(content));
        });
        return retList;
    }

    private DifficultCaseDiscussDoc getDifficultCaseDiscussDoc(String content) {
        Map<String, String> sourceMap = TzXmlUtil.getXmlToMapForTZWithReplace(content); // xml原始数据给华卓
        Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(TzXmlUtil.getXmlToMapForTZ(content), keyContrasts);

        DifficultCaseDiscussDoc difficultCaseDiscussDoc = new DifficultCaseDiscussDoc();
        difficultCaseDiscussDoc.setStructureMap(structureMap);
        difficultCaseDiscussDoc.setPageData((Map)sourceMap);
        return difficultCaseDiscussDoc;
    }

    private List<String> keyContrasts = Lists.newArrayList();

}