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

import com.lantone.qc.kernel.catalogue.QCCatalogue;
import com.lantone.qc.kernel.util.CatalogueUtil;
import com.lantone.qc.pub.model.InputInfo;
import com.lantone.qc.pub.model.OutputInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @ClassName : BEH0069
 * @Description : 家族史未填写
 * @Author : 胡敬
 * @Date: 2020-03-10 15:08
 */
@Component
public class BEH0069 extends QCCatalogue {
    @Override
    protected 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 (inputInfo.getBeHospitalizedDoc() != null && inputInfo.getBeHospitalizedDoc().getFamilyLabel() != null) {
            if (!CatalogueUtil.isEmpty(inputInfo.getBeHospitalizedDoc().getFamilyLabel().getText())) {
                status.set("0");
            }
        }
    }
}