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

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.label.PastLabel;
import com.lantone.qc.pub.util.StringUtil;
import org.springframework.stereotype.Component;

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

/**
 * @Description: 既往史未填写
 * @author: rengb
 * @time: 2020/3/10 14:02
 */
@Component
public class BEH0400 extends QCCatalogue {

    @Override
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        if (inputInfo.getBeHospitalizedDoc() == null) {
            status.set("0");
            return;
        }
        PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
        if (StringUtil.isBlank(pastLabel.getText())) {
            status.set("0");
            return;
        }
        List<String> Str = Arrays.asList("咳嗽气喘史", "胸闷心悸史", "腹痛腹泻史", "多饮多尿史", "浮肿少尿史", "尿频尿痛史", "抽搐史", "出血史", "过敏史", "药物过敏史", "传染病史", "外伤手术史", "输血史", "重大疾病史和治疗史");
        Map<String, String> structureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
        for (String s : Str) {
            if (structureMap != null && structureMap.containsKey(s)) {
                status.set("0");
                return;
            }
        }

        if (pastLabel != null && StringUtil.isNotBlank(pastLabel.getText())) {
            status.set("0");
        }
    }
}