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

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 org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;


/**
 * @ClassName : BEH0004
 * @Description : 入院记录个人基本信息缺项或信息错误
 * @Author : 楼辉荣
 * @Date: 2020-03-06 17:28
 */
@Component
public class BEH0004 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {

        status.set("0");
        if(inputInfo.getBeHospitalizedDoc() == null){
            return;
        }
        Map<String, String> structureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
        if(structureMap != null){
            String basePassage = structureMap.get("个人基本信息");
            if(StringUtils.isNotEmpty(basePassage)){
                String[] baseFilds = basePassage.split(",");
                for (String fild:baseFilds) {
                    if(StringUtils.isBlank(structureMap.get(fild))){
                        status.set("-1");
                        break;
                    }
                }
            }
        }

    }
}