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.operation.OperationDoc;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassName : OPE0348
 * @Description : 无手术知情同意书
 * @Author : kwz
 * @Date: 2020-05-30 17:07
 */
@Component
public class OPE0348 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        //先判断有无手术记录
        List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
        long count_oper =0;
        long count_info =0;
        if(operationDocs != null && operationDocs.size()>0){
            count_oper = operationDocs.stream().map(i -> i.getOperationRecordDoc()).filter(i -> i != null).count();

            count_info = operationDocs.stream().map(i -> i.getOperationInformedConsentDoc()).filter(i -> i != null).count();
            if(count_oper>0 && count_info ==0){
                status.set("-1");
            }
        }
            /*List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
            if (operationDocs.size() == 0 || operationDocs == null) {
                return;
            }
            for (OperationDoc operationDoc : operationDocs) {
                OperationDiscussionDoc operationDiscussionDoc = operationDoc.getOperationDiscussionDoc();
                if (operationDiscussionDoc == null) {
                    continue;
                }
                Map<String, String> operationDiscussionStructureMap = operationDiscussionDoc.getStructureMap();
                if (CatalogueUtil.isEmpty(operationDiscussionStructureMap.get("患方签名"))) {
                    status.set("-1");
                    return;
                }
            }*/


    }
}