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.entity.Smoking;
import com.lantone.qc.pub.util.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @Description: 吸烟史未描述
 * @author: rengb
 * @time: 2020/3/10 14:02
 */
@Component
public class BEH0046 extends QCCatalogue {

    @Override
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        if(inputInfo.getBeHospitalizedDoc() == null){
            status.set("0");
            return;
        }
        //台州结构化
        Map<String, String> structureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
        if(StringUtils.isNotEmpty(structureMap.get("吸烟"))){
            status.set("0");
            return;
        }
        Smoking smoking = inputInfo.getBeHospitalizedDoc().getPersonalLabel().getSmoking();
        if (smoking != null && StringUtil.isNotBlank(smoking.getName())) {
            status.set("0");
        }
        //硬匹配规则
        if (inputInfo.getBeHospitalizedDoc().getPersonalLabel().getText().contains("烟")) {
            status.set("0");
        }
    }

}