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 : BEH0418
 * @Description : 入院记录婚姻状况填写错误
 * @Author : 楼辉荣
 * @Date: 2020-03-06 17:28
 */
@Component
public class BEH0418 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 marry_bh = structureMap.get("婚姻");
            String marry_first = firstStructMap.get(Content.marry);
            if (!CatalogueUtil.isEmpty(marry_bh) && !CatalogueUtil.isEmpty(marry_first)) {
                if (!marry_bh.equals(marry_first)) {
                    status.set("-1");
                }
            }
        }
    }
}