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.Content;
import com.lantone.qc.pub.model.InputInfo;
import com.lantone.qc.pub.model.OutputInfo;
import org.springframework.stereotype.Component;

import java.util.Map;


/**
 * @ClassName : BEH0421
 * @Description :  入院记录入院日期填写错误
 * @Date: 2020-03-06 17:28
 */
@Component
public class BEH0421 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getBeHospitalizedDoc() == null || inputInfo.getFirstPageRecordDoc() == null) {
            return;
        }
        Map<String, String> structureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
        Map<String, String> firstStructMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
        if (structureMap != null && firstStructMap != null) {
            String admisDate_bh = structureMap.get("入院日期");
            String admisDate_first = firstStructMap.get(Content.admisDate);
            if (!CatalogueUtil.isEmpty(admisDate_bh) && !CatalogueUtil.isEmpty(admisDate_first)) {
                if (!admisDate_bh.equals(admisDate_first)) {
                    status.set("-1");
                }
            }
        }
    }
}