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

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.Map;

/**
 * @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();
        String treatPlan = firstCourseRecordStructureMap.get("诊疗计划");
        String treatmentMonitoringPlan = firstCourseRecordStructureMap.get("治疗监测计划");
        if (StringUtil.isBlank(treatPlan) && StringUtil.isBlank(treatmentMonitoringPlan)) {
            return;
        }
        treatPlan = StringUtil.isBlank(treatPlan) ? "" : treatPlan;
        treatmentMonitoringPlan = StringUtil.isBlank(treatmentMonitoringPlan) ? "" : treatmentMonitoringPlan;
        String text = treatPlan + "," + treatmentMonitoringPlan;
        if (text.contains("生命体征") && !text.contains("血压") && !text.contains("心率")) {
            status.set("-1");
            info.set("需测血压、心率");
        }
    }
}