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

import com.google.common.collect.Lists;
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.FirstCourseRecordDoc;
import com.lantone.qc.pub.util.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

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

import static com.lantone.qc.trans.comsis.ModelDocGenerate.structureMapJoin;

/**
 * @ClassName : FIRC02970
 * @Description : 首次病程记录中监测生命体征书写不规范
 * @Author : 胡敬
 * @Date: 2020-06-16 17:36
 */
@Component
public class FIRC02970 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getFirstCourseRecordDoc() == null) {
            return;
        }
        Map<String, String> firstCourseRecordStructureMap = inputInfo.getFirstCourseRecordDoc().getStructureMap();
        List<String> keys = Lists.newArrayList("需求评估", "预期目标", "诊疗计划", "治疗监测计划", "治疗计划", "检查计划");
        String text = structureMapJoin(firstCourseRecordStructureMap, keys);
        if (StringUtil.isNotBlank(text) && text.contains("生命体征") && !text.contains("血压") && !text.contains("心率") && !text.contains("心电监护")) {
            status.set("-1");
            info.set("需具体描述测血压、心率等");
        }
    }
}