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.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 BEH0041 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("出生、生长史"))
                || StringUtils.isNotEmpty(structureMap.get("疫区居留史"))
                || StringUtils.isNotEmpty(structureMap.get("冶游史"))
                || StringUtils.isNotEmpty(structureMap.get("工作性质"))
                || StringUtils.isNotEmpty(structureMap.get("化学及放射性毒物接触史"))) {
            status.set("0");
            return;
        }

        if (StringUtil.isNotBlank(inputInfo.getBeHospitalizedDoc().getPersonalLabel().getText())) {
            status.set("0");
        }
    }

}