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 : BEH0423
 * @Description : 入院记录联系电话填写错误
 * @Date: 2020-03-06 17:28
 */
@Component
public class BEH0423 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getBeHospitalizedDoc() == null || inputInfo.getFirstPageRecordDoc() == null) {
            return;
        }
        Map<String, String> bhStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
        Map<String, String> firstStructMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
        if (bhStructureMap != null && firstStructMap != null) {
            String phone = bhStructureMap.get("电话");
            String currentAddressPhone = firstStructMap.get(Content.current_address_phone);
            if (!CatalogueUtil.isEmpty(phone) && !CatalogueUtil.isEmpty(currentAddressPhone)) {
                if (!phone.equals(currentAddressPhone)) {
                    status.set("-1");
                }
            }
        }
    }
}