package com.lantone.qc.kernel.catalogue.beilun.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.model.label.TreatPlanLabel;
import com.lantone.qc.pub.util.StringUtil;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @ClassName : FIRC03086
 * @Description : 治疗措施不具体（缺护理级别）
 * @Author : wsy
 * @Date: 2021-01-07 15:21
 */
@Component
public class FIRC03086 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
        if (firstCourseRecordDoc == null) {
            status.set("0");
            return;
        }
        TreatPlanLabel treatPlanLabel = firstCourseRecordDoc.getTreatPlanLabel();
        if (treatPlanLabel == null) {
            status.set("0");
            return;
        }
        String text = treatPlanLabel.getText();
        boolean findText = false;
        if (StringUtil.isNotBlank(text) && text.contains("护理")) {
            findText = true;
        }
        Map<String, String> structureMap = firstCourseRecordDoc.getStructureMap();
        String structureV = structureMap.get("诊疗计划");
        if (StringUtil.isBlank(structureV) && StringUtil.isBlank(text)) {
            status.set("0");
            return;
        }
        if (StringUtil.isNotBlank(structureV) && structureV.contains("护理")) {
            findText = true;
        }
        if (treatPlanLabel.getNursingLevel() != null) {
            if (findText && !treatPlanLabel.getNursingLevel().getName().contains("护理常规")) {
                status.set("0");
                return;
            }
        }
        if (treatPlanLabel.getNursingLevel() == null || treatPlanLabel.getNursingLevel().getName().contains("护理常规")) {
            status.set("-1");
            return;
        }
    }
}