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

import com.lantone.qc.kernel.catalogue.QCCatalogue;
import com.lantone.qc.dbanaly.util.KernelConstants;
import com.lantone.qc.dbanaly.util.SpecialStorageUtil;
import com.lantone.qc.pub.model.InputInfo;
import com.lantone.qc.pub.model.OutputInfo;
import com.lantone.qc.pub.model.entity.BodyPart;
import com.lantone.qc.pub.model.entity.Clinical;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * @ClassName : BEH0015
 * @Description :  现病史症状缺少部位,只判断现病史中的第一个症状
 * @Author : 楼辉荣
 * @Date: 2020-03-06 17:28
 */
@Component
public class BEH0015 extends QCCatalogue {
    @Autowired
    private SpecialStorageUtil specialStorageUtil;
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if(inputInfo.getBeHospitalizedDoc() == null){
            return;
        }
        List<String> clinicalList = (List<String>) specialStorageUtil.getJsonStringValue(KernelConstants.CONCEPT_CLINIC_BODYPART_PROPERTIES_LIST);
        List<Clinical> clinicals = inputInfo.getBeHospitalizedDoc().getPresentLabel().getClinicals();
        if(clinicals.size()>0){
            Clinical clinical = clinicals.get(0);
            if(clinicalList.contains(clinical.getName())){
                BodyPart bodyPart = clinical.getBodyPart();
                if(bodyPart == null){
                    status.set("-1");
                    info.set(clinical.getName());
                }
            }

        }
    }
}