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

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.util.StringUtil;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @ClassName : BEH02969
 * @Description :  入院记录中监测生命体征书写不规范
 * @Author : 胡敬
 * @Date: 2020-06-16 13:15
 */
@Component
public class BEH02969 extends QCCatalogue {
    @Override
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getBeHospitalizedDoc() == null) {
            return;
        }
        Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
        String treatPlan = beHospitalStructureMap.get("诊疗计划");
        String treatmentMonitoringPlan = beHospitalStructureMap.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("需测血压、心率");
        }
    }
}