package com.lantone.qc.trans.changx;

import com.google.common.collect.Maps;
import com.lantone.qc.pub.Content;
import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
import com.lantone.qc.pub.model.vo.MedrecVo;
import com.lantone.qc.pub.util.FastJsonUtils;
import com.lantone.qc.trans.ModelDocTrans;

import java.util.Map;

/**
 * @Description: 病案首页文档生成
 * @author: 胡敬
 * @time: 2020/3/16 17:47
 */
public class ChangxFirstPageRecordDocTrans extends ModelDocTrans {

    @Override
    public FirstPageRecordDoc extract(MedrecVo medrecVo) {
        Map<String, String> content = (Map) medrecVo.getContent();
        FirstPageRecordDoc firstPageRecordDoc = new FirstPageRecordDoc();
        firstPageRecordDoc.setStructureMap(content);

        Map<String, Object> structureExtMap = Maps.newHashMap();
        structureExtMap.putAll(content);
        structureExtMap.put(Content.diagnose_cts, FastJsonUtils.getJsonToBean(content.get(Content.diagnose_cts), Object.class));
//        structureExtMap.put(Content.outpatientEmergencyDiag, FastJsonUtils.getJsonToBean(content.get(Content.outpatientEmergencyDiag), Object.class));
        structureExtMap.put(Content.operative_information, FastJsonUtils.getJsonToBean(content.get(Content.operative_information), Object.class));
        structureExtMap.put(Content.dischargeDiag, FastJsonUtils.getJsonToBean(content.get(Content.dischargeDiag), Object.class));
//        structureExtMap.put(Content.pathologyDiagnose, FastJsonUtils.getJsonToBean(content.get(Content.pathologyDiagnose), Object.class));
        firstPageRecordDoc.setStructureExtMap(structureExtMap);
        firstPageRecordDoc.setPageData(medrecVo.getContent());

        return firstPageRecordDoc;
    }

}