package com.lantone.qc.trans.beilun;

import com.google.common.collect.Lists;
import com.lantone.qc.pub.model.doc.LisDoc;
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: zh
 * @time: 2021/4/7 15:41
 */
public class BeiLunPacsDocTrans 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(getDoctorAdviceDoc((Map) FastJsonUtils.getJsonToMap(content)));
        });
        return retList;
    }

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

}