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

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 : THR0123
 * @Description : 入院记录未在患者入院24小时内完成
 * @Author : 胡敬
 * @Date: 2020-03-19 13:51
 */
@Component
public class THR0123 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getBeHospitalizedDoc() != null && inputInfo.getBeHospitalizedDoc().getStructureMap() != null) {
            Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
            String admisDate = beHospitalStructureMap.get(Content.admisDate);
            String recordTime = beHospitalStructureMap.get("记录日期");
            if (CatalogueUtil.isEmpty(admisDate) || CatalogueUtil.isEmpty(recordTime)) {
                return;
            }
            if (CatalogueUtil.compareTime(
                    StringUtil.parseDateTime(admisDate),
                    StringUtil.parseDateTime(recordTime),
                    Long.valueOf(24 * 60))) {
                status.set("-1");
            }

        }
    }
}