package com.lantone.qc.trans.taizhou;

import com.google.common.collect.Lists;
import com.lantone.qc.pub.model.doc.StagesSummaryDoc;
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 TaiZhouStagesSummaryDocTrans extends ModelDocTrans {

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

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

        StagesSummaryDoc stagesSummaryDoc = new StagesSummaryDoc();
        stagesSummaryDoc.setStructureMap(structureMap);
        stagesSummaryDoc.setPageData((Map)sourceMap);
        return stagesSummaryDoc;
    }

    private List<String> keyContrasts = Lists.newArrayList(
            "入院诊断=",
            "审核人=",
            "事件日期=",
            "医生=",
            "专科检查=",
            "简要病情=",
            "事件基本信息=",
            "血压=",
            "年龄=",
            "影像学检查=",
            "内容=",
            "科主任=",
            "治疗计划和措施=",
            "主诉=",
            "床号=",
            "主任医生=",
            "当前诊断=",
            "病人基本信息=",
            "实验室检查=",
            "医疗组长=",
            "就诊次数=",
            "审核日期=",
            "患者一般情况=",
            "入院情况=",
            "性别=",
            "辅助检查结果=",
            "本人姓名=",
            "病历号=",
            "初步诊断=",
            "病历日期=",
            "现病史-发病情况=",
            "呼吸=",
            "脉搏=",
            "入院日期=",
            "临床科室=",
            "年龄单位=",
            "诊治经过=",
            "病历状态=",
            "审核=",
            "体温(耳)=",
            "目前情况="
    );

}