package com.lantone.qc.trans.shaoyf;

import com.google.common.collect.Lists;
import com.lantone.qc.pub.model.doc.PacsDoc;
import com.lantone.qc.pub.model.vo.MedrecVo;
import com.lantone.qc.pub.util.FastJsonUtils;
import com.lantone.qc.trans.ModelDocTrans;

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

/**
 * @Description: 辅检信息文档生成
 * @author: HUJING
 * @time: 2020/8/14 13:17
 */
public class ShaoyfPacsDocTrans extends ModelDocTrans {

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

    private PacsDoc getPacsDoc(Map<String, String> content) {
        PacsDoc pacsDoc = new PacsDoc();
        pacsDoc.setStructureMap(content);
        pacsDoc.setPageData((Map) content);
        return pacsDoc;
    }

}