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

import com.lantone.qc.kernel.catalogue.QCCatalogue;
import com.lantone.qc.kernel.util.CatalogueUtil;
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 : DEAC0114
 * @Description : 死亡病例讨论记录无死亡原因
 * @Author : 胡敬
 * @Date: 2020-03-19 10:20
 */
@Component
public class DEAC0114 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getDeathCaseDiscussDoc() != null && inputInfo.getDeathCaseDiscussDoc().getStructureMap() != null) {
            Map<String, String> deathCaseDiscussStructureMap = inputInfo.getDeathCaseDiscussDoc().getStructureMap();
            String deathCause = deathCaseDiscussStructureMap.get("死亡原因");
            boolean findDeathCause = false;
            if (StringUtil.isNotBlank(deathCause)) {
                findDeathCause = true;
            }
            String discussionContent = deathCaseDiscussStructureMap.get("讨论内容");
            if (StringUtil.isNotEmpty(discussionContent) && discussionContent.contains("因")) {
                findDeathCause = true;
            }
            if (!findDeathCause) {
                status.set("-1");
            }
        }
    }
}