package com.docus.server;


import com.docus.core.util.Func;
import com.docus.core.util.SpringUtils;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.api.HospitalSubmitNodeServiceApi;
import com.docus.server.api.dto.HospitalSubmitNodeLogAddDTO;
import com.docus.server.api.enums.HospitalSubmitNodeEnum;
import com.docus.server.common.entity.SdryPacsPrintExcept;
import com.docus.server.common.service.SdryPacsPrintExceptService;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;

import java.util.Properties;


@Slf4j
@EnableFeignClients(basePackages = {"com.docus"})
//@EnableHystrix
@SpringBootApplication(scanBasePackages = {"com.docus"})
@MapperScan("com.docus.server.**.mapper")
public class AppRunBootstrap {
    public static void main(String[] args) {
        Properties props = System.getProperties();
        props.setProperty("org.apache.cxf.stax.allowInsecureParser", "1");
        props.setProperty("UseSunHttpHandler", "true");
        System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
        SpringApplication.run(AppRunBootstrap.class, args);
    }
    private static void test1(){
       SpringUtils.getBean(SdryPacsPrintExceptService.class).insert(new SdryPacsPrintExcept());
    }
    private static void test(){
        HospitalSubmitNodeServiceApi hospitalSubmitNodeServiceApi = SpringUtils.getBean(HospitalSubmitNodeServiceApi.class);
        HospitalSubmitNodeLogAddDTO dto = new HospitalSubmitNodeLogAddDTO();
        dto.setPatientId("1008611");
        dto.setContent(new String[]{"豪哥躺进了icu。狗头.pdf"});

        dto.setCreaterName("重症提交");
        dto.setCreater("重症提交");
        dto.setSubmitNodeEnum(HospitalSubmitNodeEnum.ICU);
        CommonResult<String> commonResult = hospitalSubmitNodeServiceApi.addLog(dto);
        log.info(Func.toJson(commonResult));
    }
}
