package com.lantone.qc.kernel.catalogue.ywzxyy.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.Clinical;
import com.lantone.qc.pub.model.entity.Property;
import com.lantone.qc.pub.model.label.PresentLabel;
import com.lantone.qc.pub.util.StringUtil;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * @ClassName : BEH0016
 * @Description :  现病史症状缺少性质
 * @Author : 楼辉荣
 * @Date: 2020-03-06 17:28
 */
@Component
public class BEH0016 extends QCCatalogue {

    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getBeHospitalizedDoc() == null) {
            return;
        }
        PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
        if (presentLabel == null || StringUtil.isBlank(presentLabel.getText())) {
            return;
        }
        List<Clinical> clinicals = inputInfo.getBeHospitalizedDoc().getPresentLabel().getClinicals();
        if (clinicals.size() > 0) {
            Clinical clinical = clinicals.get(0);
            Property property = clinical.getProperty();
            if (property == null) {
                info.set(clinical.getName());
                status.set("-1");
            }
        }
    }
}
