package com.diagbot.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import com.diagbot.facade.str.BStrAdmissionNoteFacade;
import com.diagbot.facade.str.BStrBloodResultFacade;
import com.diagbot.facade.str.BStrBloodTransfusionFacade;
import com.diagbot.facade.str.BStrConsultationApplyFacade;
import com.diagbot.facade.str.BStrConsultationNoteFacade;
import com.diagbot.facade.str.BStrConsultationRecordFacade;
import com.diagbot.facade.str.BStrConsultationResultFacade;
import com.diagbot.facade.str.BStrCrisisNoteFacade;
import com.diagbot.facade.str.BStrDeathDiscussionFacade;
import com.diagbot.facade.str.BStrDeathNoteFacade;
import com.diagbot.facade.str.BStrDifficultCaseFacade;
import com.diagbot.facade.str.BStrFirstRecordFacade;
import com.diagbot.facade.str.BStrIllCriticallyFacade;
import com.diagbot.facade.str.BStrIllSeriouslFacade;
import com.diagbot.facade.str.BStrLeaveHospitalFacade;
import com.diagbot.facade.str.BStrOperativeFirstRecordFacade;
import com.diagbot.facade.str.BStrOperativeNoteFacade;
import com.diagbot.facade.str.BStrPeriodConclusionFacade;
import com.diagbot.facade.str.BStrPreoperativeDiscussionFacade;
import com.diagbot.facade.str.BStrRescueNoteFacade;
import com.diagbot.facade.str.BStrTransferInNoteFacade;
import com.diagbot.facade.str.BStrTransferOutNoteFacade;
import com.diagbot.facade.str.BStrWardRecordFacade;

import lombok.extern.slf4j.Slf4j;

/**
 * 启动时执行缓存，将字段名和注释存储到MAP类型的缓存中
 */
@Slf4j
@Component
public class ColumnCacheUtil implements ApplicationRunner {

    @Override
    public void run(ApplicationArguments args) throws Exception {
        try {
            bStrBloodResultFacade.getColumnZhAndCh();
            bStrBloodTransfusionFacade.getColumnZhAndCh();
            bStrAdmissionNoteFacade.getColumnZhAndCh();//入院记录
            bStrFirstRecordFacade.getColumnZhAndCh();
            bStrPeriodConclusionFacade.getColumnZhAndCh();
            bStrTransferInNoteFacade.getColumnZhAndCh();
            bStrTransferOutNoteFacade.getColumnZhAndCh();
            bStrIllSeriouslFacade.getColumnZhAndCh();
            bStrIllCriticallyFacade.getColumnZhAndCh();
            bStrDifficultCaseFacade.getColumnZhAndCh();
            bStrDeathNoteFacade.getColumnZhAndCh();
            bStrDeathDiscussionFacade.getColumnZhAndCh();
            bStrWardRecordFacade.getColumnZhAndCh();
            bStrOperativeFirstRecordFacade.getColumnZhAndCh();
            bStrPreoperativeDiscussionFacade.getColumnZhAndCh();
            bStrOperativeNoteFacade.getColumnZhAndCh();
            bStrRescueNoteFacade.getColumnZhAndCh();
            bStrCrisisNoteFacade.getColumnZhAndCh();
            bStrLeaveHospitalFacade.getColumnZhAndCh();
            bStrConsultationApplyFacade.getColumnZhAndCh();
            bStrConsultationResultFacade.getColumnZhAndCh();
            bStrConsultationNoteFacade.getColumnZhAndCh();
            bStrConsultationRecordFacade.getColumnZhAndCh();
            log.info("列名和注释缓存初始化完成！");
        }catch (Exception e){
            log.error(e.getMessage(),e);
        }
    }
    @Autowired
    private BStrAdmissionNoteFacade bStrAdmissionNoteFacade;
    @Autowired
    private BStrFirstRecordFacade bStrFirstRecordFacade;
    @Autowired
    private BStrPeriodConclusionFacade bStrPeriodConclusionFacade;
    @Autowired
    private BStrBloodResultFacade bStrBloodResultFacade;
    @Autowired
    private BStrBloodTransfusionFacade bStrBloodTransfusionFacade;
    @Autowired
    private BStrTransferInNoteFacade bStrTransferInNoteFacade;
    @Autowired
    private BStrTransferOutNoteFacade bStrTransferOutNoteFacade;
    @Autowired
    private BStrIllSeriouslFacade bStrIllSeriouslFacade;
    @Autowired
    private BStrIllCriticallyFacade bStrIllCriticallyFacade;
    @Autowired
    private BStrDifficultCaseFacade bStrDifficultCaseFacade;
    @Autowired
    private BStrDeathNoteFacade bStrDeathNoteFacade;
    @Autowired
    private BStrDeathDiscussionFacade bStrDeathDiscussionFacade;
    @Autowired
    private BStrWardRecordFacade bStrWardRecordFacade;
    @Autowired
    private BStrOperativeFirstRecordFacade bStrOperativeFirstRecordFacade;
    @Autowired
    private BStrPreoperativeDiscussionFacade bStrPreoperativeDiscussionFacade;
    @Autowired
    private BStrOperativeNoteFacade bStrOperativeNoteFacade;
    @Autowired
    private BStrRescueNoteFacade bStrRescueNoteFacade;
    @Autowired
    private BStrCrisisNoteFacade bStrCrisisNoteFacade;
    @Autowired
    private BStrLeaveHospitalFacade bStrLeaveHospitalFacade;
    @Autowired
    private BStrConsultationApplyFacade bStrConsultationApplyFacade;
    @Autowired
    private BStrConsultationResultFacade bStrConsultationResultFacade;
    @Autowired
    private BStrConsultationNoteFacade bStrConsultationNoteFacade;
    @Autowired
    private BStrConsultationRecordFacade bStrConsultationRecordFacade;
}
