package com.lantone.qc.trans.taizhou;

import com.google.common.collect.Lists;
import com.lantone.qc.pub.model.doc.ReasonableDiagnosisDoc;
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/17 13:27
 */
public class TaiZhouReasonableDiagnosisDocTrans extends ModelDocTrans {

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

    private ReasonableDiagnosisDoc getReasonableDiagnosisDoc(String content) {
        Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(TzXmlUtil.getXmlToMapForTZ(content), keyContrasts);

        ReasonableDiagnosisDoc reasonableDiagnosisDoc = new ReasonableDiagnosisDoc();
        reasonableDiagnosisDoc.setStructureMap(structureMap);

        return reasonableDiagnosisDoc;
    }

    private List<String> keyContrasts = Lists.newArrayList();

}