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 : BEH0417
 * @Description : 入院记录出生地填写错误
 * @Author : 楼辉荣
 * @Date: 2020-03-06 17:28
 */
@Component
public class BEH0417 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 contactAddress_bh = structureMap.get("出生地");
            String contactAddress_first = firstStructMap.get(Content.birth_address);
            if (!CatalogueUtil.isEmpty(contactAddress_bh) && !CatalogueUtil.isEmpty(contactAddress_first)) {
                if (!contactAddress_first.equals(contactAddress_bh)) {
                    status.set("-1");
                }
            }
        }
    }
}