package com.lantone.qc.trans.taizhou;

import com.google.common.collect.Lists;
import com.lantone.qc.pub.model.doc.SeriouslyIllNoticeDoc;
import com.lantone.qc.pub.model.vo.MedrecVo;
import com.lantone.qc.trans.ModelDocTrans;
import com.lantone.qc.trans.comsis.OrdinaryAssistant;
import com.lantone.qc.trans.taizhou.util.TzXmlUtil;

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

/**
 * @Description: 病重通知书文档生成
 * @author: rengb
 * @time: 2020/3/19 19:41
 */
public class TaiZhouSeriouslyIllNoticeDocTrans extends ModelDocTrans {

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

    private SeriouslyIllNoticeDoc getSeriouslyIllNoticeDoc(String content) {
        Map<String, String> sourceMap = TzXmlUtil.getXmlToMapForTZWithReplace(content); // xml原始数据给华卓
        Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(TzXmlUtil.getXmlToMapForTZ(content), keyContrasts);

        SeriouslyIllNoticeDoc seriouslyIllNoticeDoc = new SeriouslyIllNoticeDoc();
        seriouslyIllNoticeDoc.setStructureMap(structureMap);
        seriouslyIllNoticeDoc.setPageData((Map)sourceMap);
        return seriouslyIllNoticeDoc;
    }

    private List<String> keyContrasts = Lists.newArrayList(
            "关系=",
            "家属信息=",
            "患者签字=",
            "当前诊断=",
            "床号=",
            "审核人=",
            "病人基本信息=",
            "审核日期=",
            "事件日期=",
            "家属意见=",
            "医生=",
            "性别=",
            "本人姓名=",
            "病历号=",
            "病历日期=",
            "入院日期=",
            "临床科室=",
            "简要病情=",
            "年龄单位=",
            "事件基本信息=",
            "审核=",
            "病历状态=",
            "年龄=",
            "内容="
    );

}