package com.lantone.qc.kernel.catalogue.clinicalblood;

import com.lantone.qc.kernel.catalogue.QCCatalogue;
import com.lantone.qc.pub.model.InputInfo;
import com.lantone.qc.pub.model.OutputInfo;
import com.lantone.qc.pub.model.doc.ClinicalBloodDoc;
import com.lantone.qc.pub.util.ListUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @ClassName : CLI0306
 * @Description : 输血记录中无输血指征
 * CRF缺少足够标注数据，使用规则判断输血原因是否有数字
 * @Author : 楼辉荣
 * @Date: 2020-03-06 17:28
 */
@Component
public class CLI0306 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        List<ClinicalBloodDoc> clinicalBloodDocs = inputInfo.getClinicalBloodDocs();
        if (ListUtil.isEmpty(clinicalBloodDocs)) {
            status.set("0");
            return;
        }
        if (clinicalBloodDocs != null && clinicalBloodDocs.size() > 0) {
            for (ClinicalBloodDoc cliB : clinicalBloodDocs) {
                Map<String, String> cliBStructureMap = cliB.getStructureMap();
                //台州
                if (StringUtils.isNotEmpty(cliBStructureMap.get("输血检验指标"))) {
                    status.set("0");
                    break;
                }
                String infusionReason = cliBStructureMap.get("输注原因");
                if (StringUtils.isNotEmpty(infusionReason)) {
                    status.set("0");
                }
            }
        } else {
            status.set("0");
        }

    }
}