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

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 com.lantone.qc.pub.util.StringUtil;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @ClassName : FIRP0166
 * @Description : 婚姻状况与入院记录中不一致
 * @Author : 胡敬
 * @Date: 2020-03-16 10:04
 */
@Component
public class FIRP0166 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null
                && inputInfo.getBeHospitalizedDoc() != null && inputInfo.getBeHospitalizedDoc().getStructureMap() != null) {
            Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
            Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
            String firstAdmissionMarry = firstpageStructureMap.get(Content.marry);
            String admissionMarry = beHospitalStructureMap.get(Content.marry);
            if (StringUtil.isBlank(firstAdmissionMarry) || StringUtil.isBlank(admissionMarry)) {
                return;
            }
            if (!CatalogueUtil.compareToken(firstAdmissionMarry, admissionMarry)) {
                status.set("-1");
            }
        }
    }
}