package com.lantone.qc.kernel.catalogue.yiwu.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 com.lantone.qc.pub.util.StringUtil;
import org.springframework.stereotype.Component;

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

/**
 * @ClassName : CLI0571
 * @Description :  输血记录Rh血型未填写
 * @Author : 楼辉荣
 * @Date: 2020-03-06 17:28
 */
@Component
public class CLI0571 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        List<ClinicalBloodDoc> clinicalBloodDocs = inputInfo.getClinicalBloodDocs();
        if (ListUtil.isEmpty(clinicalBloodDocs)) {
            return;
        }
        if (clinicalBloodDocs != null && clinicalBloodDocs.size() > 0) {
            for (ClinicalBloodDoc cliB : clinicalBloodDocs) {
                Map<String, String> cliBStructureMap = cliB.getStructureMap();
                String title = cliBStructureMap.get("病程标题");
                if (StringUtil.isNotBlank(title) && title.contains("蛋白")) {
                    continue;
                }
                if (StringUtil.isNotBlank(cliBStructureMap.get("RH"))) {
                    continue;
                }
                String record = cliBStructureMap.get("病情记录");
                if (!record.contains("Rh") && !record.contains("rh") && !record.contains("RH")) {
                    status.set("-1");
                    break;
                }
            }
        }
    }
}