package com.lantone.qc.trans.ywzxyy.util;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.lantone.qc.dbanaly.facade.ywzxyy.YwzxyyXmlUtil;
import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
import lombok.extern.slf4j.Slf4j;

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

/**
 * @Description:
 * @author: rengb
 * @time: 2021/1/25 14:04
 */
@Slf4j
public class YwzxyyThreeLevelWardXmlAnalysis implements YwzxyyXmlAnalysis {

    @Override
    public Map<String, String> analysis(String... args) {
        Map<String, String> structureMap = Maps.newHashMap();
        try {
            String xml = args[0];
            String text = YwzxyyXmlUtil.bcXmlAna(xml);
            List<String> titles = CommonAnalysisUtil.sortTitles(Lists.newArrayList("病历记录时间", "病历记录标题", "原始文本", "记录医师"), text);
            CommonAnalysisUtil.cutByTitles(text, titles, 0, structureMap);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return structureMap;
    }

}