package com.lantone.qc.trans.shaoyf;

import com.google.common.collect.Lists;
import com.lantone.qc.dbanaly.facade.shaoyf.ShaoyfXmlUtil;
import com.lantone.qc.pub.model.doc.NursingSystemDoc;
import com.lantone.qc.pub.model.vo.MedrecVo;
import com.lantone.qc.trans.ModelDocTrans;
import com.lantone.qc.trans.comsis.OrdinaryAssistant;

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

/**
 * @Description: 分级护理制度文档生成
 * @author: rengb
 * @time: 2020/3/17 13:26
 */
public class ShaoyfNursingSystemDocTrans extends ModelDocTrans {

    @Override
    public NursingSystemDoc extract(MedrecVo medrecVo) {
        Map<String, Object> contentMap = ((List<Map>) medrecVo.getContent().get("content")).get(0);
        String content = contentMap.get("xmlText").toString();

        Map<String, String> sourceMap = ShaoyfXmlUtil.getXmlToMap(content);
        sourceMap.put("mode_id=" + contentMap.get("modeId").toString(), "");
        sourceMap.put("rec_title=" + contentMap.get("recTitle").toString(), "");
        Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);

        NursingSystemDoc nursingSystemDoc = new NursingSystemDoc();
        nursingSystemDoc.setStructureMap(structureMap);

        return nursingSystemDoc;
    }

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

}