package com.lantone.qc.trans.taizhou;

import com.google.common.collect.Lists;
import com.lantone.qc.pub.model.doc.ClinicBloodEffectDoc;
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;

/**
 * @ClassName : TaiZhouClinicBloodEffectDocTrans
 * @Description : 输血后效果评价
 * @Author : 楼辉荣
 * @Date: 2020-04-19 17:53
 */
public class TaiZhouClinicBloodEffectDocTrans extends ModelDocTrans {
    @Override
    public List<ClinicBloodEffectDoc> extract(MedrecVo medrecVo) {
        List<ClinicBloodEffectDoc> retList = Lists.newArrayList();
        List<String> contents = (List) medrecVo.getContent().get("content");
        contents.forEach(content -> {
            retList.add(getClinicBloodEffectDoc(content));
        });
        return retList;
    }

    private ClinicBloodEffectDoc getClinicBloodEffectDoc(String content) {
        Map<String, String> sourceMap = TzXmlUtil.getXmlToMapForTZ(content);
        Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(TzXmlUtil.getXmlToMapForTZ(content), keyContrasts);

        ClinicBloodEffectDoc clinicBloodEffectDoc = new ClinicBloodEffectDoc();
        clinicBloodEffectDoc.setStructureMap(structureMap);
        clinicBloodEffectDoc.setPageData((Map)sourceMap);
        return clinicBloodEffectDoc;
    }

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