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

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 org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @ClassName : BEH0076
 * @Description : 体格检查未填写
 * @Author : 胡敬
 * @Date: 2020-03-10 15:10
 */
@Component
public class BEH0076 extends QCCatalogue {
    @Override
    protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
        if (inputInfo.getBeHospitalizedDoc() == null) {
            status.set("0");
            return;
        }
        Map<String, String> structureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
        //以台州为例，个人史细分很多结构化信息，取其一
        if (StringUtils.isNotEmpty(structureMap.get("体温(口)"))
                || StringUtils.isNotEmpty(structureMap.get("脉搏"))
                || StringUtils.isNotEmpty(structureMap.get("血压"))
                || StringUtils.isNotEmpty(structureMap.get("身高"))) {
            status.set("0");
            return;
        }
        if (inputInfo.getBeHospitalizedDoc() != null && inputInfo.getBeHospitalizedDoc().getVitalLabel() != null) {
            if (!CatalogueUtil.isEmpty(inputInfo.getBeHospitalizedDoc().getVitalLabel().getText())) {
                status.set("0");
            }
        }
    }
}