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

import com.lantone.qc.kernel.catalogue.QCCatalogue;
import com.lantone.qc.kernel.util.CatalogueUtil;
import com.lantone.qc.pub.model.InputInfo;
import com.lantone.qc.pub.model.OutputInfo;
import com.lantone.qc.pub.model.doc.operation.OperationDoc;
import com.lantone.qc.pub.model.doc.operation.PreoperativeDiscussionDoc;
import com.lantone.qc.pub.util.ListUtil;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @Description:  术前讨论记录未记录具体讨论意见
 * @author: kwz
 * @time: 2020/3/30 13:28
 */
@Component
public class OPE0578 extends QCCatalogue {
    @Override
    protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
        if(operationDocs!= null && operationDocs.size()>0){
            pre:
            for (OperationDoc od:operationDocs) {
                PreoperativeDiscussionDoc preoperativeDiscussionDoc = od.getPreoperativeDiscussionDoc();
                if(preoperativeDiscussionDoc != null){
                    Map<String, String> preMap = preoperativeDiscussionDoc.getStructureMap();
                    if(preMap != null && preMap.containsKey("讨论结论")){
                        if(CatalogueUtil.isEmpty(preMap.get("讨论结论"))){
                            status.set("-1");
                            break pre;
                        }
                    }else {
                        status.set("-1");
                        break pre;
                    }
                }
            }
        }
    }
}