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

import java.util.ArrayList;
import java.util.List;


/**
 * @ClassName : BEH0013
 * @Description :  现病史缺少有鉴别意义的阴性症状
 * @Author : 楼辉荣
 * @Date: 2020-03-06 17:28
 */
@Component
public class BEH0013 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) {
            return;
        }
        String text = presentLabel.getText();
        if (StringUtil.isNotBlank(text)) {
            if ((text.contains("无") || text.contains("否认")) && !text.contains("诱因")) {
                return;
            }
        } else {
            return;
        }
        List<Clinical> clinicalNegative = new ArrayList<>();
        List<Clinical> clinicals = presentLabel.getClinicals();
        if (clinicals.size() > 0) {
            for (Clinical clinical : clinicals) {
                if (clinical.getNegative() != null) {
                    clinicalNegative.add(clinical);
                }
            }
        }
        if (clinicalNegative.size() == 0) {
            status.set("-1");
        }
    }
}