首页 > 代码库 > 看看一个配置文件,了解ESB的编程模型
看看一个配置文件,了解ESB的编程模型
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-event="http://www.springframework.org/schema/integration/event" xmlns:int-file="http://www.springframework.org/schema/integration/file" xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp" xmlns:int-groovy="http://www.springframework.org/schema/integration/groovy" xmlns:int-http="http://www.springframework.org/schema/integration/http" xmlns:int-httpinvoker="http://www.springframework.org/schema/integration/httpinvoker" xmlns:int-ip="http://www.springframework.org/schema/integration/ip" xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc" xmlns:int-stream="http://www.springframework.org/schema/integration/stream" xmlns:int-xml="http://www.springframework.org/schema/integration/xml" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml-2.0.xsd http://www.springframework.org/schema/integration/groovy http://www.springframework.org/schema/integration/groovy/spring-integration-groovy-2.0.xsd http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc-2.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration/event http://www.springframework.org/schema/integration/event/spring-integration-event-2.0.xsd http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http-2.0.xsd http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.0.xsd http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip-2.0.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file-2.0.xsd http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/integration/httpinvoker http://www.springframework.org/schema/integration/httpinvoker/spring-integration-httpinvoker-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- 获取目录下的的包中的所有类 --> <context:component-scan base-package="com.tjbt.hiscase.tools" /> <int:gateway id="IGetPatientInfo" service-interface="com.tjbt.hiscase.service.IGetPatientInfo" default-request-channel="channel1"> </int:gateway> <int:gateway id="IGetClinicInfo" service-interface="com.tjbt.hiscase.service.IGetClinicInfo" default-request-channel="Clinicchannel1"> </int:gateway> <int:poller id="globalPoller" default="true" max-messages-per-poll="1" cron="0-59 * * * * ?" /> <!-- 建立一个channel 即连接数据库获取到的记录的channel --> <int:channel id="channel1"> <!-- <int:interceptors> --> <!-- <int:wire-tap channel="logger" /> --> <!-- </int:interceptors> --> </int:channel> <!-- 分割一个数组 分割成一条条的记录 --> <int:splitter id="testSplitter" input-channel="channel1" output-channel="channel2" /> <int:splitter id="testSplitter1" input-channel="Clinicchannel1" output-channel="Clinicchannel2" /> <int:channel id="channel2"> <int:queue capacity="10" /> </int:channel> <int:channel id="Clinicchannel2"> <int:queue capacity="10" /> </int:channel> <int:header-enricher input-channel="channel2" output-channel="channel3"> <int:header name="exportType" value="患者住院信息" /> <int:header name="patientId" expression="payload.patientId" /> <int:header name="visitId" expression="payload.visitId" /> <int:header name="catalogDate" expression="payload.catalogDate" /> <int:header name="exportSize" expression="1" /> <int:header name="exportManner" value="manual"></int:header> </int:header-enricher> <int:header-enricher input-channel="Clinicchannel2" output-channel="Clinicchannel3"> <int:header name="exportType" expression="‘门诊信息‘+payload.visitNo" /> <int:header name="visitDate" expression="payload.visitDate" /> <int:header name="visitNo" expression="payload.visitNo" /> <int:header name="exportManner" value="auto"></int:header> </int:header-enricher> <int:channel id="channel3"> <int:queue capacity="10" /> </int:channel> <int:channel id="Clinicchannel3"> <int:queue capacity="10" /> </int:channel> <int:filter input-channel="channel3" output-channel="channel3x" ref="mapper" /> <int:splitter input-channel="channel3x" output-channel="channel4" ref="DataBaseService" method="dispatch" /> <int:splitter input-channel="Clinicchannel3" output-channel="channel4" ref="ClinicService" method="dispatch" /> <int:channel id="channel4"> <int:queue capacity="1" /> </int:channel> <int:transformer ref="mapper" input-channel="channel4" output-channel="channel5" /> <int:publish-subscribe-channel id="channel5" > </int:publish-subscribe-channel> <!-- 把转换好的xml输出到一个目录下 --> <!-- <int-file:outbound-channel-adapter channel="channel5" id="filesOut" directory="D:\数据交换平台导出目录" charset="UTF-8" filename-generator-expression="headers.get(‘patientId‘) == null ? headers.exportType + ‘-‘ + @mapper.getFileCreatedTime() +‘.xml‘ : headers.exportType +‘-‘ + headers.patientId + ‘-‘ + headers.visitId + ‘-‘ + @mapper.getFileCreatedTime() + ‘.xml‘" />--> <!-- 把转换好的xml输出到一个目录下 --> <int-file:outbound-channel-adapter channel="channel5" id="filesOutbackup" directory="D:\数据交换平台导入目录" charset="UTF-8" filename-generator-expression="headers.get(‘patientId‘) == null ? headers.exportType + ‘-‘ + @mapper.getFileCreatedTime() +‘.xml‘ : headers.exportType +‘-‘ + headers.patientId + ‘-‘ + headers.visitId + ‘-‘ + @mapper.getFileCreatedTime() + ‘.xml‘" /> <int:chain input-channel="channel5" output-channel="channelbl6"> <int:filter expression="headers.get(‘patientId‘) != null" /> <int:service-activator ref="AnalyseXMLService" method="callJar"> <int:poller receive-timeout="5000" fixed-rate="1000" /> </int:service-activator> </int:chain> <int:channel id="channelbl6"> <int:queue capacity="100" /> </int:channel><!-- <int:chain input-channel="channelbl6" output-channel="logger"> <int:service-activator ref="blexportFile" method="saveFile"> <int:poller receive-timeout="5000" fixed-rate="1000" /> </int:service-activator> </int:chain> <bean id="blexportFile" class="com.tjbt.hiscase.service.ExportFile" autowire="byType"> <property name="directory" value="http://www.mamicode.com/D:/数据交换平台导入目录/bl"></property> <property name="charset" value="http://www.mamicode.com/UTF-8"></property> <property name="filename_generator_expression" value="http://www.mamicode.com/headers.get(‘patientId‘) == null ? headers.exportType + ‘-‘ + ‘.xml‘ : headers.exportType +‘-‘ + headers.patientId + ‘-‘ + headers.visitId + ‘-‘ + ‘.xml‘" /> </bean> --> <!--<int-stream:stdout-channel-adapter channel="logger" append-newline="true" />--> <int:wire-tap pattern="*" order="1" channel="logger" /> <int:channel id="logger"> <int:queue capacity="1000" /> </int:channel> <int:channel id="errorChannel"> <int:queue capacity="500" /> </int:channel></beans>
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-event="http://www.springframework.org/schema/integration/event" xmlns:int-file="http://www.springframework.org/schema/integration/file" xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp" xmlns:int-groovy="http://www.springframework.org/schema/integration/groovy" xmlns:int-http="http://www.springframework.org/schema/integration/http" xmlns:int-httpinvoker="http://www.springframework.org/schema/integration/httpinvoker" xmlns:int-ip="http://www.springframework.org/schema/integration/ip" xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc" xmlns:int-stream="http://www.springframework.org/schema/integration/stream" xmlns:int-xml="http://www.springframework.org/schema/integration/xml" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml-2.0.xsd http://www.springframework.org/schema/integration/groovy http://www.springframework.org/schema/integration/groovy/spring-integration-groovy-2.0.xsd http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc-2.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration/event http://www.springframework.org/schema/integration/event/spring-integration-event-2.0.xsd http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http-2.0.xsd http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.0.xsd http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip-2.0.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file-2.0.xsd http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/integration/httpinvoker http://www.springframework.org/schema/integration/httpinvoker/spring-integration-httpinvoker-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- 获取目录下的的包中的所有类 --> <context:component-scan base-package="com.tjbt.hiscase.tools" /> <int:gateway id="IGetPatientInfo" service-interface="com.tjbt.hiscase.service.IGetPatientInfo" default-request-channel="channel1"> </int:gateway> <int:gateway id="IGetClinicInfo" service-interface="com.tjbt.hiscase.service.IGetClinicInfo" default-request-channel="Clinicchannel1"> </int:gateway> <int:poller id="globalPoller" default="true" max-messages-per-poll="1" cron="0-59 * * * * ?" /> <!-- 建立一个channel 即连接数据库获取到的记录的channel --> <int:channel id="channel1"> <!-- <int:interceptors> --> <!-- <int:wire-tap channel="logger" /> --> <!-- </int:interceptors> --> </int:channel> <!-- 分割一个数组 分割成一条条的记录 --> <int:splitter id="testSplitter" input-channel="channel1" output-channel="channel2" /> <int:splitter id="testSplitter1" input-channel="Clinicchannel1" output-channel="Clinicchannel2" /> <int:channel id="channel2"> <int:queue capacity="10" /> </int:channel> <int:channel id="Clinicchannel2"> <int:queue capacity="10" /> </int:channel> <int:header-enricher input-channel="channel2" output-channel="channel3"> <int:header name="exportType" value="患者住院信息" /> <int:header name="patientId" expression="payload.patientId" /> <int:header name="visitId" expression="payload.visitId" /> <int:header name="catalogDate" expression="payload.catalogDate" /> <int:header name="exportSize" expression="1" /> <int:header name="exportManner" value="manual"></int:header> </int:header-enricher> <int:header-enricher input-channel="Clinicchannel2" output-channel="Clinicchannel3"> <int:header name="exportType" expression="‘门诊信息‘+payload.visitNo" /> <int:header name="visitDate" expression="payload.visitDate" /> <int:header name="visitNo" expression="payload.visitNo" /> <int:header name="exportManner" value="auto"></int:header> </int:header-enricher> <int:channel id="channel3"> <int:queue capacity="10" /> </int:channel> <int:channel id="Clinicchannel3"> <int:queue capacity="10" /> </int:channel> <int:filter input-channel="channel3" output-channel="channel3x" ref="mapper" /> <int:splitter input-channel="channel3x" output-channel="channel4" ref="DataBaseService" method="dispatch" /> <int:splitter input-channel="Clinicchannel3" output-channel="channel4" ref="ClinicService" method="dispatch" /> <int:channel id="channel4"> <int:queue capacity="10" /> </int:channel> <int:transformer ref="mapper" input-channel="channel4" output-channel="channel5" /> <int:publish-subscribe-channel id="channel5" /> <!-- 把转换好的xml输出到一个目录下 --> <!-- <int-file:outbound-channel-adapter channel="channel5" id="filesOut" directory="D:\数据交换平台导出目录" charset="UTF-8" filename-generator-expression="headers.get(‘patientId‘) == null ? headers.exportType + ‘-‘ + @mapper.getFileCreatedTime() +‘.xml‘ : headers.exportType +‘-‘ + headers.patientId + ‘-‘ + headers.visitId + ‘-‘ + @mapper.getFileCreatedTime() + ‘.xml‘" /> --> <!-- 把转换好的xml输出到一个目录下 --> <int-file:outbound-channel-adapter channel="channel5" id="filesOutbackup" directory="D:\数据交换平台导入目录" charset="UTF-8" filename-generator-expression="headers.get(‘patientId‘) == null ? headers.exportType + ‘-‘ + @mapper.getFileCreatedTime() +‘.xml‘ : headers.exportType +‘-‘ + headers.patientId + ‘-‘ + headers.visitId + ‘-‘ + @mapper.getFileCreatedTime() + ‘.xml‘" /> <int:chain input-channel="channel5" output-channel="channelbl6"> <int:filter expression="headers.get(‘patientId‘) != null" /> <int:service-activator ref="AnalyseXMLService" method="callJar"> <int:poller receive-timeout="5000" fixed-rate="1000" /> </int:service-activator> </int:chain> <int:channel id="channelbl6"> <int:queue capacity="100" /> </int:channel> <int:chain input-channel="channelbl6" output-channel="logger"> <int:service-activator ref="blexportFile" method="saveFile"> <int:poller receive-timeout="5000" fixed-rate="1000" /> </int:service-activator> </int:chain> <bean id="blexportFile" class="com.tjbt.hiscase.service.ExportFile" autowire="byType"> <property name="directory" value="D:\数据交换平台导入目录\bl"></property> <property name="charset" value="UTF-8"></property> <property name="filename_generator_expression" value="headers.get(‘patientId‘) == null ? headers.exportType + ‘-‘ + ‘.xml‘ : headers.exportType +‘-‘ + headers.patientId + ‘-‘ + headers.visitId + ‘-‘ + ‘.xml‘" /> </bean> <!-- <int-stream:stdout-channel-adapter channel="logger" append-newline="true" /> --> <int:wire-tap pattern="*" order="1" channel="logger" /> <int:channel id="logger"> <int:queue capacity="1000" /> </int:channel> <int:channel id="errorChannel"> <int:queue capacity="500" /> </int:channel><bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" > <property name="brokerURL" value="tcp://localhost:61616"></property> </bean> <bean id="destination" class="org.apache.activemq.command.ActiveMQQueue"> <constructor-arg index="0" value="testmq"></constructor-arg> </bean> <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory" ref="connectionFactory"></property> <property name="defaultDestination" ref="destination"></property> <!--<property name="messageConverter" ref="innerMessageConverter"></property> --> </bean> <bean id="MessageGateWay" class="com.tjbt.hiscase.mqUtil.MessageGateWay"> <property name="jsmt" ref="jmsTemplate" ></property> </bean> <bean id="messageListener" class="com.tjbt.hiscase.mqUtil.MessageMDB"> <property name="ms" ref="MessageService"></property> </bean> <bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer" lazy-init="false"> <property name="connectionFactory" ref="connectionFactory"></property> <property name="destination" ref="destination"></property> <property name="messageListener" ref="messageListener"></property> <property name="concurrentConsumers" value="2"></property> <!--0:CACHE_NONE,1:CACHE_CONNECTION,2:CACHE_SESSION,3:CACHE_CONSUMER,4:CACHE_AUTO--> <property name="cacheLevel" value="0"/> </bean> <bean id="MessageService" class="com.tjbt.hiscase.service.MessageService"></bean></beans>
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-event="http://www.springframework.org/schema/integration/event" xmlns:int-file="http://www.springframework.org/schema/integration/file" xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp" xmlns:int-groovy="http://www.springframework.org/schema/integration/groovy" xmlns:int-http="http://www.springframework.org/schema/integration/http" xmlns:int-httpinvoker="http://www.springframework.org/schema/integration/httpinvoker" xmlns:int-ip="http://www.springframework.org/schema/integration/ip" xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc" xmlns:int-stream="http://www.springframework.org/schema/integration/stream" xmlns:int-xml="http://www.springframework.org/schema/integration/xml" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml-2.0.xsd http://www.springframework.org/schema/integration/groovy http://www.springframework.org/schema/integration/groovy/spring-integration-groovy-2.0.xsd http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc-2.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration/event http://www.springframework.org/schema/integration/event/spring-integration-event-2.0.xsd http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http-2.0.xsd http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.0.xsd http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip-2.0.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file-2.0.xsd http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/integration/httpinvoker http://www.springframework.org/schema/integration/httpinvoker/spring-integration-httpinvoker-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- 获取目录下的的包中的所有类 --> <context:component-scan base-package="com.tjbt.hiscase.tools" /> <int:gateway id="IGetPatientInfo" service-interface="com.tjbt.hiscase.service.IGetPatientInfo" default-request-channel="channel1"> </int:gateway> <int:gateway id="IGetClinicInfo" service-interface="com.tjbt.hiscase.service.IGetClinicInfo" default-request-channel="Clinicchannel1"> </int:gateway> <int:poller id="globalPoller" default="true" max-messages-per-poll="1" cron="0-59 * * * * ?" /> <int:inbound-channel-adapter ref="DataBaseService" method="inbound" channel="channel1" auto-startup="${HisCaseIsExport}"> <int:poller cron="${HisCaseInterval}" /> <int:header name="exportType" value="患者住院信息" /> </int:inbound-channel-adapter> <int:inbound-channel-adapter ref="ClinicService" method="getInfo" channel="Clinicchannel1" auto-startup="${ClinicIsExport}"> <int:poller cron="${ClinicInterval}" /> <int:header name="exportType" value="门诊信息" /> </int:inbound-channel-adapter> <!-- 全表导出配置 --> <int:inbound-channel-adapter id="exprotCountry" ref="DataBaseService" method="exprotCountry" channel="channel4" auto-startup="${CountryTypeIsExport}"> <int:poller cron="${CountryTypeInterval}" /> <int:header name="exportType" value="国家字典" /> </int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotArea" ref="DataBaseService" method="exprotArea" channel="channel4" auto-startup="${AreaIsExport}"> <int:poller cron="${AreaInterval}" /> <int:header name="exportType" value="行政区字典" /> </int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotDept" ref="DataBaseService" method="exprotDept" channel="channel4" auto-startup="${DeptIsExport}"> <int:poller cron="${DeptInterval}" /> <int:header name="exportType" value="科室表" /> </int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotUsers" ref="DataBaseService" method="exprotUsers" channel="channel4" auto-startup="${UsersIsExport}"> <int:poller cron="${UsersInterval}" /> <int:header name="exportType" value="用户记录" /> </int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotDiagnosis" ref="DataBaseService" method="exprotDiagnosis" channel="channel4" auto-startup="${DiagnosisIsExport}"> <int:poller cron="${DiagnosisInterval}" /> <int:header name="exportType" value="诊断字典" /> </int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotStaff" ref="DataBaseService" method="exprotStaff" channel="channel4" auto-startup="${StaffIsExport}"> <int:poller cron="${StaffInterval}" /> <int:header name="exportType" value="员工信息" /> </int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotDrugName" ref="DataBaseService" method="exprotDrugName" channel="channel4" auto-startup="${DrugNameIsExport}"> <int:poller cron="${DrugNameInterval}" /> <int:header name="exportType" value="药品名称字典" /> </int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotLabReportItem" ref="DataBaseService" method="exprotLabReportItem" channel="channel4" auto-startup="${LabReportItemIsExport}"> <int:poller cron="${LabReportItemInterval}" /> <int:header name="exportType" value="项目报告字典" /> </int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotOrderClass" ref="DataBaseService" method="exprotOrderClass" channel="channel4" auto-startup="${OrderClassIsExport}"> <int:poller cron="${OrderClassInterval}" /> <int:header name="exportType" value="医嘱类别字典" /> </int:inbound-channel-adapter> <int:inbound-channel-adapter id="exportDeptVsWard" ref="DataBaseService" method="exportDeptVsWard" channel="channel4" auto-startup="${DeptWardIsExport}"> <int:poller cron="${DeptWardInterval}" /> <int:header name="exportType" value="临床科室与病房(区)对照" /> </int:inbound-channel-adapter> <int:inbound-channel-adapter id="exportDiagCorrDict" ref="DataBaseService" method="exportDiagCorrDict" channel="channel4" auto-startup="${DiagCorrDictIsExport}"> <int:poller cron="${DiagCorrDictInterval}" /> <int:header name="exportType" value="诊断是否符合参数表" /> </int:inbound-channel-adapter> <int:inbound-channel-adapter id="exportStaffVsGroup" ref="DataBaseService" method="exportStaffVsGroup" channel="channel4" auto-startup="${StaffVsGroupIsExport}"> <int:poller cron="${StaffVsGroupInterval}" /> <int:header name="exportType" value="员工分组情况" /> </int:inbound-channel-adapter><int:inbound-channel-adapter id="exportPatsInHospital" ref="DataBaseService" method="exportPatsInHospital" channel="channel4" auto-startup="${PatsInHospitalIsExport}"> <int:poller cron="${PatsInHospitalInterval}" /> <int:header name="exportType" value="住院信息" /> </int:inbound-channel-adapter> <!-- 建立一个channel 即连接数据库获取到的记录的channel --> <int:channel id="channel1"> <!-- <int:interceptors> --> <!-- <int:wire-tap channel="logger" /> --> <!-- </int:interceptors> --> </int:channel> <!-- 分割一个数组 分割成一条条的记录 --> <int:splitter id="testSplitter" input-channel="channel1" output-channel="channel2" /> <int:splitter id="testSplitter1" input-channel="Clinicchannel1" output-channel="Clinicchannel2" /> <int:channel id="channel2"> <int:queue capacity="10" /> </int:channel> <int:channel id="Clinicchannel2"> <int:queue capacity="10" /> </int:channel> <int:header-enricher input-channel="channel2" output-channel="channel3"> <int:header name="exportType" value="患者住院信息" /> <int:header name="patientId" expression="payload.patientId" /> <int:header name="visitId" expression="payload.visitId" /> <int:header name="catalogDate" expression="payload.catalogDate" /> <int:header name="exportManner" value="auto"></int:header> </int:header-enricher> <int:header-enricher input-channel="Clinicchannel2" output-channel="Clinicchannel3"> <int:header name="exportType" expression="‘门诊信息‘+payload.visitDate+payload.visitNo" /> <int:header name="visitDate" expression="payload.visitDate" /> <int:header name="visitNo" expression="payload.visitNo" /> <int:header name="exportManner" value="auto"></int:header> </int:header-enricher> <int:channel id="channel3"> <int:queue capacity="10" /> </int:channel> <int:channel id="Clinicchannel3"> <int:queue capacity="10" /> </int:channel> <!-- <int:chain input-channel="channel3" output-channel="channel3x"> --> <!-- <int:header-enricher> --> <!-- <int:header name="exportManner" value="http://www.mamicode.com/auto" /> --> <!-- </int:header-enricher> --> <!-- <int:filter ref="mapper" /> --> <!-- </int:chain> --> <int:filter input-channel="channel3" output-channel="channel3x" ref="mapper" /> <int:splitter input-channel="channel3x" output-channel="channel4" ref="DataBaseService" method="dispatch" /> <int:splitter input-channel="Clinicchannel3" output-channel="channel4" ref="ClinicService" method="dispatch" /> <int:channel id="channel4"> <int:queue capacity="1" /> </int:channel> <int:chain input-channel="channel4" output-channel="channel5"> <int:header-enricher> <int:header name="exportSize" expression="payload.getSize()" /> </int:header-enricher> <int:transformer ref="mapper" /> </int:chain> <int:publish-subscribe-channel id="channel5" /> <!-- 把转换好的xml输出到一个目录下 --> <!--<int-file:outbound-channel-adapter channel="channel5" id="filesOut" directory="D:\数据交换平台导出目录" charset="UTF-8" filename-generator-expression="headers.get(‘patientId‘) == null ? headers.exportType + ‘-‘ + @mapper.getFileCreatedTime() +‘.xml‘ : headers.exportType +‘-‘ + headers.patientId + ‘-‘ + headers.visitId + ‘-‘ + @mapper.getFileCreatedTime() + ‘.xml‘" />--> <!--<int-file:outbound-channel-adapter channel="channel5" id="filesOut" directory="D:\" />--> <!-- 把转换好的xml输出到一个目录下 --> <!-- <int-file:outbound-channel-adapter --> <!-- channel="channel5" id="filesOutbackup" directory="D:\bbb" charset="UTF-8" --> <!-- filename-generator-expression="headers.get(‘patientId‘) == null ? headers.exportType + ‘-‘ + ‘.xml‘ : headers.exportType +‘-‘ + headers.patientId + ‘-‘ + headers.visitId + ‘-‘ + @mapper.getFileCreatedTime() + ‘.xml‘" / --> <int:bridge input-channel="channel5" output-channel="channel6"> </int:bridge> <int:channel id="channel6"> <int:queue capacity="100" /> </int:channel> <int:chain input-channel="channel6" output-channel="logger"> <int:service-activator ref="exportFile" method="saveFile"> <int:poller receive-timeout="5000" fixed-rate="100" /> </int:service-activator> </int:chain> <int:chain input-channel="channel5"> <int:filter expression="headers.get(‘patientId‘) != null" /> <int:service-activator ref="AnalyseXMLService" method="callJar"> <int:poller receive-timeout="5000" fixed-rate="200" /> </int:service-activator> </int:chain> <int:channel id="channelBLGenerator"> <int:queue capacity="100" /> </int:channel> <int:chain input-channel="channelBLGenerator" output-channel="logger"> <int:filter expression="headers.get(‘patientId‘) != null" /> <int:service-activator ref="blexportFile" method="saveFile"> <int:poller receive-timeout="5000" fixed-rate="200" /> </int:service-activator> </int:chain> <bean id="blexportFile" class="com.tjbt.hiscase.service.ExportFile" autowire="byType"> <property name="directory" value="D:\数据交换平台导入目录\bl"></property> <property name="charset" value="UTF-8"></property> <property name="filename_generator_expression" value="headers.get(‘patientId‘) == null ? headers.exportType + ‘-‘ + ‘.xml‘ : headers.exportType +‘-‘ + headers.patientId + ‘-‘ + headers.visitId + ‘-‘ + ‘.xml‘" /> </bean> <!--<int-stream:stdout-channel-adapter channel="logger" append-newline="true" />--> <int:wire-tap pattern="*" order="1" channel="logger" /> <int:channel id="logger"> <int:queue capacity="1000" /> </int:channel> <int:channel id="errorChannel"> <int:queue capacity="500" /> </int:channel> <bean id="exportLoggerInterceptor" class="com.tjbt.hiscase.tools.ExportLoggerInterceptor"> </bean> <bean id="exportFile" class="com.tjbt.hiscase.service.ExportFile" autowire="byType"> <property name="directory" value="D:\数据交换平台导入目录"></property> <property name="charset" value="UTF-8"></property> <property name="filename_generator_expression" value="headers.get(‘patientId‘) == null ? headers.exportType + ‘-‘ + ‘.xml‘ : headers.exportType +‘-‘ + headers.patientId + ‘-‘ + headers.visitId + ‘-‘ + ‘.xml‘" /> </bean></beans>
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int-event="http://www.springframework.org/schema/integration/event" xmlns:int-file="http://www.springframework.org/schema/integration/file" xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp" xmlns:int-groovy="http://www.springframework.org/schema/integration/groovy" xmlns:int-http="http://www.springframework.org/schema/integration/http" xmlns:int-httpinvoker="http://www.springframework.org/schema/integration/httpinvoker" xmlns:int-ip="http://www.springframework.org/schema/integration/ip" xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc" xmlns:int-stream="http://www.springframework.org/schema/integration/stream" xmlns:int-xml="http://www.springframework.org/schema/integration/xml" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xmlns:int="http://www.springframework.org/schema/integration" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml-2.0.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd http://www.springframework.org/schema/integration/groovy http://www.springframework.org/schema/integration/groovy/spring-integration-groovy-2.0.xsd http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc-2.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration/event http://www.springframework.org/schema/integration/event/spring-integration-event-2.0.xsd http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http-2.0.xsd http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.0.xsd http://www.springframework.org/schema/integration/feed http://www.springframework.org/schema/integration/feed/spring-integration-feed-2.0.xsd http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip-2.0.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file-2.0.xsd http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/integration/httpinvoker http://www.springframework.org/schema/integration/httpinvoker/spring-integration-httpinvoker-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.tjbt.hiscase.tools" /> <!-- poller 轮循病历 找到文件的目录 filename-pattern="*.xml" 找到.xml 没有的过滤掉--> <int-file:inbound-channel-adapter id="blfilesIn" directory="D:\数据交换平台导入目录\bl" prevent-duplicates="false" filename-pattern="*.xml"> <int:poller fixed-rate="1000" /> </int-file:inbound-channel-adapter> <int-file:file-to-string-transformer input-channel="blfilesIn" delete-files="true" output-channel="blString" charset="UTF-8" /> <int:channel id="blString"> <int:queue capacity="10" /> </int:channel> <int:service-activator ref="AnalyseXMLService" method="analyseHiscase" input-channel="blString" output-channel="channel5"> <int:poller receive-timeout="5000" fixed-rate="1000" /> </int:service-activator> <!-- <int:chain id="main-chain" input-channel="blfilesIn" output-channel="blString"> --> <!-- <int:header-enricher> --> <!-- <int:header name="filename" expression="payload.getName()" /> --> <!-- </int:header-enricher> --> <!-- <int-file:file-to-string-transformer delete-files="true" charset="UTF-8" /> --> <!-- </int:chain> --> <!-- <int:channel id="blString"> --> <!-- <int:queue capacity="10" /> --> <!-- </int:channel> --> <!-- <int:router input-channel="blString" --> <!-- expression="headers.filename.substring(headers.filename.indexOf(‘_‘)+1).startsWith(‘病程记录‘)"> --> <!-- <int:mapping value="http://www.mamicode.com/true" channel="bcjlChannel" /> --> <!-- <int:mapping value="http://www.mamicode.com/false" channel="fbcjlChannel"/> --> <!-- <int:poller fixed-rate="1000" /> --> <!-- </int:router> --> <!-- <int:channel id="bcjlChannel"> --> <!-- <int:queue capacity="10" /> --> <!-- </int:channel> --> <!-- <int:channel id="fbcjlChannel"> --> <!-- <int:queue capacity="10" /> --> <!-- </int:channel> --> <!-- 病程类文件保存方法 --> <!-- <int:service-activator ref="AnalyseXMLService" --> <!-- method="analyseHisProcess" input-channel="bcjlChannel" output-channel="channel5"> --> <!-- <int:poller receive-timeout="5000" fixed-rate="1000" /> --> <!-- </int:service-activator> --> <!-- poller 轮循 找到文件的目录 --> <int-file:inbound-channel-adapter id="filesIn" directory="D:\数据交换平台导入目录" prevent-duplicates="false" filename-pattern="*.xml" > <int:poller fixed-rate="1000" /> <!-- <int-file:nio-locker/> --> </int-file:inbound-channel-adapter> <!-- 把文件转换成String --> <int-file:file-to-string-transformer input-channel="filesIn" output-channel="output" delete-files="true" charset="UTF-8" /> <int:channel id="output"> <int:queue capacity="10" /> </int:channel> <int:transformer ref="mapper" input-channel="output" output-channel="channel3"> <int:poller max-messages-per-poll="1" cron="0-59 * * * * ?" /> </int:transformer> <int:channel id="channel3"> <int:queue capacity="10" /> </int:channel> <int:service-activator ref="DataBaseService" method="saveAll" input-channel="channel3" output-channel="channel5"> <int:poller receive-timeout="5000" fixed-rate="100" /> </int:service-activator> <int:channel id="channel5"> <int:queue capacity="1000" /> </int:channel> <int:chain input-channel="channel5" output-channel="logger"> <int:header-enricher> <int:header name="importType" value="患者住院信息" /> </int:header-enricher> </int:chain> <int:wire-tap pattern="*" order="3" channel="logger" /> <int:channel id="logger"> <int:queue capacity="1000" /> </int:channel> <!-- 准备一个线程池 --> <task:executor id="taskExecutor" pool-size="50" queue-capacity="20" /> <int:channel id="errorChannel"> <int:queue capacity="500" /> </int:channel> <int:poller id="globalPoller" default="true" max-messages-per-poll="1" cron="0-59 * * * * ?" /></beans>
上述是我们做的一个数据交换平台,主要完成数据的抽取工作,分为人工和手工的数据抽取。
数据源:
文件系统
数据库
FTP数据源
JMS消息数据源
通过上述的了解,我们大致可以了解ETL,其实ETL仅仅是数据交换平台的一个过程
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。