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

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.DoctorAdviceDoc;
import com.lantone.qc.pub.model.doc.operation.OperationDoc;
import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.util.List;

/**
 * @Description: 缺手术安全核查表 ,前提要有手术记录
 * @author: kwz
 * @time: 2020/06/29 11:22
 */
@Component
public class OPE0313 extends QCCatalogue {

    @Override
    protected void start(InputInfo inputInfo, OutputInfo outputInfo) throws ParseException {
        status.set("0");
        //先判断有无手术记录
        List<OperationDoc> operationDocs = inputInfo.getOperationDocs();

        if(operationDocs != null && operationDocs.size()>0){
            long count_oper = operationDocs.stream().map(i -> i.getOperationRecordDoc()).filter(i -> i != null).count();

            long count_safe = operationDocs.stream().map(i -> i.getOperationSafetyChecklistDoc()).filter(i -> i != null).count();
            if(count_oper>0 && count_safe ==0){
                status.set("-1");
            }
        }

    }

}