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

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

/**
 * @ClassName : OPE0649
 * @Description : 术后首程麻醉方式未填写
 * @Author : 胡敬
 * @Date: 2020-03-30 10:10
 */
@Component
public class OPE0649 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
        if(operationDocs == null || operationDocs.size() == 0){
            status.set("0");
            return;
        }
        for (OperationDoc operationDoc : operationDocs) {
            OperationDiscussionDoc operationDiscussionDoc = operationDoc.getOperationDiscussionDoc();
            if (operationDiscussionDoc == null) {
                continue;
            }
            Map<String, String> operationDiscussionStructureMap = operationDiscussionDoc.getStructureMap();
            if (operationDiscussionStructureMap.containsKey("麻醉方式") && CatalogueUtil.isEmpty(operationDiscussionStructureMap.get("麻醉方式"))) {
                status.set("-1");
                return;
            }
        }
    }
}