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.springframework.stereotype.Component;

import java.util.Map;

/**
 * @ClassName : BEH02960
 * @Description : 生育史未填写（结构化数据）
 * @Author : 胡敬
 * @Date: 2020-06-16 13:15
 */
@Component
public class BEH02960 extends QCCatalogue {
    @Override
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getBeHospitalizedDoc() == null) {
            return;
        }
        Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
        String marry = beHospitalStructureMap.get("婚姻");
        if (StringUtil.isNotBlank(marry) && "未婚".equals(marry)) {
            return;
        }
        if (StringUtil.isBlank(beHospitalStructureMap.get("顺产(足月)"))
                && StringUtil.isBlank(beHospitalStructureMap.get("早产"))
                && StringUtil.isBlank(beHospitalStructureMap.get("流产"))
                && StringUtil.isBlank(beHospitalStructureMap.get("存活"))) {
            status.set("-1");
        }
    }
}