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

import java.util.List;

/**
 * @ClassName : BEH0071
 * @Description : 父母、兄弟、姐妹及子女的健康状况未描述
 * @Author : 胡敬
 * @Date: 2020-03-11 15:09
 */
@Component
public class BEH0071 extends QCCatalogue {
    @Override
    protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
        if (inputInfo.getBeHospitalizedDoc() == null) {
            status.set("0");
            return;
        }
        if (inputInfo.getBeHospitalizedDoc().getFamilyLabel() != null) {
            FamilyLabel familyLabel = inputInfo.getBeHospitalizedDoc().getFamilyLabel();
            List<Family> families = familyLabel.getFamilies();
            for (Family family:families) {
                if (family.getHealthCondition() != null && StringUtil.isNotBlank(family.getHealthCondition().getName())){
                    status.set("0");
                    return;
                }
            }
        }
    }
}