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.Pacs;
import com.lantone.qc.pub.model.label.PacsLabel;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassName : BEH02903
 * @Description : 辅助检查未注明时间
 * @Author : 胡敬
 * @Date: 2020-05-28 09:56
 */
@Component
public class BEH02903 extends QCCatalogue {
    @Override
    protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getBeHospitalizedDoc() == null) {
            return;
        }

        PacsLabel pacsLabel = inputInfo.getBeHospitalizedDoc().getPacsLabel();
        if (pacsLabel == null) {
            status.set("0");
            return;
        }

        List<Pacs> pacses = pacsLabel.getPacses();
        if (pacses != null && pacses.size() > 0) {
            for (Pacs pacs : pacses) {
                if (pacs.getName() == null && pacs.getPd() == null) {
                    status.set("-1");
                    return;
                }
            }
        }
    }
}