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

import com.lantone.qc.kernel.catalogue.QCCatalogue;
import com.lantone.qc.kernel.util.CatalogueUtil;
import com.lantone.qc.pub.Content;
import com.lantone.qc.pub.model.InputInfo;
import com.lantone.qc.pub.model.OutputInfo;
import org.springframework.stereotype.Component;

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

/**
 * @ClassName : FIRP0244
 * @Description :  手术切口等级填写的与手术记录不一致
 * @Author : 楼辉荣
 * @Date: 2020-03-06 17:28ss
 */
@Component
public class FIRP0244 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
            Map<String, Object> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
            List<Map<String, String>> operative_information = (List<Map<String, String>>) firstpageStructureMap.get(Content.operative_information);
            if(operative_information != null && operative_information.size()>0){
                for (Map<String,String> opInfo:operative_information) {
                    if(!CatalogueUtil.isEmpty(opInfo.get(Content.operative_name)) && CatalogueUtil.isEmpty(opInfo.get(Content.notch_grade))){
                        status.set("-1");
                        break;
                    }
                }
            }
        }
    }
}