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.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 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((Map) FastJsonUtils.getJsonToMap(content)));
        });
        return retList;
    }

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

}