package com.lantone.qc.trans.shaoyf;

import com.google.common.collect.Lists;
import com.lantone.qc.pub.model.doc.LisDoc;
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: rengb
 * @time: 2020/3/19 19:41
 */
public class ShaoyfLisDocTrans extends ModelDocTrans {

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

    private LisDoc getLisDoc(Map<String, String> content) {
        LisDoc lisDoc = new LisDoc();
        lisDoc.setStructureMap(content);
        lisDoc.setPageData((Map) content);
        return lisDoc;
    }

}