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

import java.util.Map;

/**
 * @ClassName : FIRC0092
 * @Description : 治疗措施不具体
 * @Author : 胡敬
 * @Date: 2020-03-24 15:21
 */
@Component
public class FIRC0092 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) {
            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.isNotBlank(structureV) && structureV.contains("护理")){
            findText = true;
        }
        if ((treatPlanLabel.getNursingLevel() != null || findText) &&
                (treatPlanLabel.getMedicine() != null || treatPlanLabel.getTreat().size() > 0
                        || treatPlanLabel.getPacs().size() > 0)) {
            status.set("0");
            return;
        }
        String message = "";
        if (treatPlanLabel.getNursingLevel() == null) {
            message += "无护理级别;";
        }
        if (ListUtil.isEmpty(treatPlanLabel.getPacs())) {
            message += "无化验或辅检;";

        }
        info.set(message);
    }
}