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

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

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

/**
 * @ClassName : NUR0293
 * @Description : 医嘱无护理级别（一级护理/二级护理/三级护理/特级护理）（医嘱部分）
 * @Author : 楼辉荣
 * @Date: 2020-03-06 17:28
 */
@Component
public class NUR0293 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        List<DoctorAdviceDoc> doctorAdviceDocs = inputInfo.getDoctorAdviceDocs();
        if (doctorAdviceDocs == null || doctorAdviceDocs.size() == 0) {
            status.set("0");
            return;
        }
        List<DoctorAdviceDoc> filters = doctorAdviceDocs.stream().filter(doctorAdviceDoc ->
            StringUtils.isNotEmpty(doctorAdviceDoc.getStructureMap().get("医嘱项目名称"))
                    && doctorAdviceDoc.getStructureMap().get("医嘱项目名称").indexOf("护理") > -1
            ).distinct().collect(Collectors.toList());
        if (filters.size() > 0) {
            status.set("0");
        }
    }
}