package com.lantone.qc.trans.taizhou;

import com.google.common.collect.Lists;
import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
import com.lantone.qc.pub.model.vo.MedrecVo;
import com.lantone.qc.pub.util.MapUtil;
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/19 19:41
 */
public class TaiZhouDoctorAdviceDocTrans extends ModelDocTrans {

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

    private DoctorAdviceDoc getDoctorAdviceDoc(String content) {
        MapUtil.consoleKey(TzXmlUtil.getXmlToMapForTZ(content));
        Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(TzXmlUtil.getXmlToMapForTZ(content), keyContrasts);

        DoctorAdviceDoc doctorAdviceDoc = new DoctorAdviceDoc();
        doctorAdviceDoc.setStructureMap(structureMap);

        return doctorAdviceDoc;
    }

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

}