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

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.doc.ThreeLevelWardDoc;
import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
import com.lantone.qc.pub.util.ListUtil;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassName : THR0431
 * @Description : 危重患者上级医师(副高及以上)查房记录无诊疗意见
 * @Author : Mark
 * @Date: 2020-04-04 19:21
 */
@Component
public class THR0431 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getThreeLevelWardDocs().size() == 0 || ListUtil.isEmpty(inputInfo.getSeriouslyIllNoticeDocs())) {
            return;
        }
        List<ThreeLevelWardDoc> allDoctorWradDocs = inputInfo.getThreeLevelWardDocs().get(0).getAllDoctorWradDocs();
        for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
            List<ThreeLevelWardLabel> threeLevelWardLabels = threeLevelWardDoc.getThreeLevelWardLabel();
            for (ThreeLevelWardLabel threeLevelWardLabel : threeLevelWardLabels) {
                if (threeLevelWardLabel.getSerious() != 1) {
                    continue;
                }
                if (threeLevelWardLabel.getTreatmentPlans().size() == 0) {
                    status.set("-1");
                    return;
                }
            }
        }
    }
}