码迷,mamicode.com
首页 > 其他好文 > 详细

Kettle同步设计思路

时间:2014-05-15 09:02:58      阅读:415      评论:0      收藏:0      [点我收藏+]

标签:kettle   同步   

最近在整理之前的同步的kettle代码,现把之前的kettle同步的思路记录在此。

1.同步流程图,下图是同步的整个流程图

bubuko.com,布布扣

2.外部的数据表,根据业务逻辑更新到服务器端的业务表,下图是其中的一个示例图:

bubuko.com,布布扣

这个的思路是:获取最新需同步的数据、分别查出药品分类ID、药品分类与分类关联ID以及药品ID(不存在,则生成新的UUID)、查询数据库中药品分类ID的记录数是否存在(即是否不为0)、首先插入或更新药品分类表

如果药品分类表中无该条记录,则通过同步标识字段查询出新插入的药品分类ID、插入药品分类关联表、插入药品表;

如果药品分类表中有改条记录,则更新药品分类关联表、更新药品表、更新药品批号表、更新处方表;

下面是这个同步的全部xml:

<transformation>
  <info>
    <name>updateHisDrugData</name>
    <description/>
    <extended_description/>
    <trans_version/>
    <trans_type>Normal</trans_type>
    <trans_status>0</trans_status>
    <directory>/updateServerData/commonData</directory>
    <parameters>
    </parameters>
    <log>
<trans-log-table><connection/>
<schema/>
<table/>
<size_limit_lines/>
<interval/>
<timeout_days/>
<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STATUS</id><enabled>Y</enabled><name>STATUS</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name><subject/></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name><subject/></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name><subject/></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name><subject/></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name><subject/></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name><subject/></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>STARTDATE</id><enabled>Y</enabled><name>STARTDATE</name></field><field><id>ENDDATE</id><enabled>Y</enabled><name>ENDDATE</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>DEPDATE</id><enabled>Y</enabled><name>DEPDATE</name></field><field><id>REPLAYDATE</id><enabled>Y</enabled><name>REPLAYDATE</name></field><field><id>LOG_FIELD</id><enabled>Y</enabled><name>LOG_FIELD</name></field></trans-log-table>
<perf-log-table><connection/>
<schema/>
<table/>
<interval/>
<timeout_days/>
<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>SEQ_NR</id><enabled>Y</enabled><name>SEQ_NR</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>INPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>INPUT_BUFFER_ROWS</name></field><field><id>OUTPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>OUTPUT_BUFFER_ROWS</name></field></perf-log-table>
<channel-log-table><connection/>
<schema/>
<table/>
<timeout_days/>
<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>LOGGING_OBJECT_TYPE</id><enabled>Y</enabled><name>LOGGING_OBJECT_TYPE</name></field><field><id>OBJECT_NAME</id><enabled>Y</enabled><name>OBJECT_NAME</name></field><field><id>OBJECT_COPY</id><enabled>Y</enabled><name>OBJECT_COPY</name></field><field><id>REPOSITORY_DIRECTORY</id><enabled>Y</enabled><name>REPOSITORY_DIRECTORY</name></field><field><id>FILENAME</id><enabled>Y</enabled><name>FILENAME</name></field><field><id>OBJECT_ID</id><enabled>Y</enabled><name>OBJECT_ID</name></field><field><id>OBJECT_REVISION</id><enabled>Y</enabled><name>OBJECT_REVISION</name></field><field><id>PARENT_CHANNEL_ID</id><enabled>Y</enabled><name>PARENT_CHANNEL_ID</name></field><field><id>ROOT_CHANNEL_ID</id><enabled>Y</enabled><name>ROOT_CHANNEL_ID</name></field></channel-log-table>
<step-log-table><connection/>
<schema/>
<table/>
<timeout_days/>
<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>LOG_FIELD</id><enabled>N</enabled><name>LOG_FIELD</name></field></step-log-table>
    </log>
    <maxdate>
      <connection/>
      <table/>
      <field/>
      <offset>0.0</offset>
      <maxdiff>0.0</maxdiff>
    </maxdate>
    <size_rowset>10000</size_rowset>
    <sleep_time_empty>50</sleep_time_empty>
    <sleep_time_full>50</sleep_time_full>
    <unique_connections>N</unique_connections>
    <feedback_shown>Y</feedback_shown>
    <feedback_size>50000</feedback_size>
    <using_thread_priorities>Y</using_thread_priorities>
    <shared_objects_file/>
    <capture_step_performance>N</capture_step_performance>
    <step_performance_capturing_delay>1000</step_performance_capturing_delay>
    <step_performance_capturing_size_limit>100</step_performance_capturing_size_limit>
    <dependencies>
    </dependencies>
    <partitionschemas>
    </partitionschemas>
    <slaveservers>
    </slaveservers>
    <clusterschemas>
    </clusterschemas>
  <created_user>-</created_user>
  <created_date>2012/11/15 14:27:53.963</created_date>
  <modified_user>-</modified_user>
  <modified_date>2013/02/05 09:53:33.010</modified_date>
  </info>
  <notepads>
  </notepads>
  <connection>
    <name>backupConn</name>
    <server>localhost</server>
    <type>ORACLE</type>
    <access>Native</access>
    <database>orcl</database>
    <port>1521</port>
    <username>backup</username>
    <password>Encrypted 2be98afc86aa7f2e4cb79ac71dd99baca</password>
    <servername/>
    <data_tablespace/>
    <index_tablespace/>
    <attributes>
      <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
      <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
      <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
      <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
      <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
    </attributes>
  </connection>
  <connection>
    <name>hisConn</name>
    <server>his.com</server>
    <type>ORACLE</type>
    <access>Native</access>
    <database>orcl</database>
    <port>1521</port>
    <username>his</username>
    <password>Encrypted 2be98afc86aa7f2e4cb79ce10be9aa6c9</password>
    <servername/>
    <data_tablespace/>
    <index_tablespace/>
    <attributes>
      <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
      <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
      <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
      <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
      <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
    </attributes>
  </connection>
  <connection>
    <name>serverConn</name>
    <server>server.iwmds.rdh.com</server>
    <type>ORACLE</type>
    <access>Native</access>
    <database>orcl</database>
    <port>1521</port>
    <username>qdias</username>
    <password>Encrypted 2be98afc86aa7f2e4cb79ce61da9baec9</password>
    <servername/>
    <data_tablespace/>
    <index_tablespace/>
    <attributes>
      <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
      <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
      <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
      <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
      <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
    </attributes>
  </connection>
  <connection>
    <name>wardConn</name>
    <server>ward.iwmds.rdh.com</server>
    <type>ORACLE</type>
    <access>Native</access>
    <database>xe</database>
    <port>1521</port>
    <username>ward</username>
    <password>Encrypted 2be98afc86aa7f2e4cb79ce10c993bdde</password>
    <servername/>
    <data_tablespace/>
    <index_tablespace/>
    <attributes>
      <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>INITIAL_POOL_SIZE</code><attribute>50</attribute></attribute>
      <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
      <attribute><code>MAXIMUM_POOL_SIZE</code><attribute>500</attribute></attribute>
      <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
      <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
      <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
      <attribute><code>USE_POOLING</code><attribute>Y</attribute></attribute>
    </attributes>
  </connection>
  <order>
  <hop> <from>值映射</from><to>数据库查询V_DRUG_CLASS_STRUCT_ID</to><enabled>Y</enabled> </hop>  <hop> <from>增加常量</from><to>调用DB存储过程V_DRUG_CLASS_ID</to><enabled>Y</enabled> </hop>  <hop> <from>插入 / 更新IWMDS_DRUG_CLASS</from><to>过滤记录</to><enabled>Y</enabled> </hop>  <hop> <from>插入 / 更新IWMDS_DRUG_DETAIL</from><to>更新 IWMDS_DRUG_BATCH</to><enabled>Y</enabled> </hop>  <hop> <from>数据库查询V_DRUG_CLASS_STRUCT_ID</from><to>调用DB存储过程V_DRUG_CLASS_COUNT</to><enabled>Y</enabled> </hop>  <hop> <from>更新 IWMDS_DRUG_BATCH</from><to>更新 IWMDS_PRESCRIPTION_DETAIL</to><enabled>Y</enabled> </hop>  <hop> <from>表输入</from><to>增加常量</to><enabled>Y</enabled> </hop>  <hop> <from>调用DB存储过程V_DRUG_CLASS_COUNT</from><to>插入 / 更新IWMDS_DRUG_CLASS</to><enabled>Y</enabled> </hop>  <hop> <from>调用DB存储过程V_DRUG_CLASS_ID</from><to>调用DB存储过程V_DRUG_LINK_ID</to><enabled>Y</enabled> </hop>  <hop> <from>调用DB存储过程V_DRUG_DETAIL_ID</from><to>值映射</to><enabled>Y</enabled> </hop>  <hop> <from>调用DB存储过程V_DRUG_LINK_ID</from><to>调用DB存储过程V_DRUG_DETAIL_ID</to><enabled>Y</enabled> </hop>  <hop> <from>过滤记录</from><to>数据库查询V_DRUG_CLASS_ID_C</to><enabled>Y</enabled> </hop>  <hop> <from>数据库查询V_DRUG_CLASS_ID_C</from><to>插入 / 更新IWMDS_DRUG_CLASS_STRUCT_LINK 2</to><enabled>Y</enabled> </hop>  <hop> <from>插入 / 更新IWMDS_DRUG_CLASS_STRUCT_LINK 2</from><to>插入 / 更新IWMDS_DRUG_DETAIL 2</to><enabled>Y</enabled> </hop>  <hop> <from>过滤记录</from><to>插入 / 更新IWMDS_DRUG_CLASS_STRUCT_LINK</to><enabled>Y</enabled> </hop>  <hop> <from>插入 / 更新IWMDS_DRUG_CLASS_STRUCT_LINK</from><to>插入 / 更新IWMDS_DRUG_DETAIL</to><enabled>Y</enabled> </hop>  </order>
  <step>
    <name>值映射</name>
    <type>ValueMapper</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <field_to_use>ENABLE_FLAG</field_to_use>
    <target_field/>
    <non_match_default/>
    <fields>
      <field>
        <source_value>Y</source_value>
        <target_value>0</target_value>
      </field>
      <field>
        <source_value>N</source_value>
        <target_value>1</target_value>
      </field>
    </fields>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>135</xloc>
      <yloc>558</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>增加常量</name>
    <type>Constant</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <fields>
      <field>
        <name>V_INFO_SOURCE_TYPE</name>
        <type>String</type>
        <format/>
        <currency/>
        <decimal/>
        <group/>
        <nullif>SOURCE_SYNC</nullif>
        <length>0</length>
        <precision>0</precision>
      </field>
    </fields>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>140</xloc>
      <yloc>132</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>插入 / 更新IWMDS_DRUG_CLASS</name>
    <type>InsertUpdate</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <commit>100</commit>
    <update_bypassed>N</update_bypassed>
    <lookup>
      <schema/>
      <table>IWMDS_DRUG_CLASS</table>
      <key>
        <name>V_INFO_SOURCE_TYPE</name>
        <field>INFO_SOURCE_TYPE</field>
        <condition>=</condition>
        <name2/>
      </key>
      <key>
        <name>DRUG_ID</name>
        <field>INFO_SOURCE_ID</field>
        <condition>=</condition>
        <name2/>
      </key>
      <value>
        <name>DRUG_CLASS_ID</name>
        <rename>V_DRUG_CLASS_ID</rename>
        <update>N</update>
      </value>
      <value>
        <name>DRUG_CLASS_CODE</name>
        <rename>DRUG_CODE</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_CLASS_CN_NAME</name>
        <rename>DRUG_COMMON_CN_NAME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_CLASS_EN_NAME</name>
        <rename>DRUG_COMMON_EN_NAME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>REMARKS</name>
        <rename>REMARKS</rename>
        <update>Y</update>
      </value>
      <value>
        <name>INFO_ORDER</name>
        <rename>INFO_ORDER</rename>
        <update>Y</update>
      </value>
      <value>
        <name>IS_DELETE</name>
        <rename>ENABLE_FLAG</rename>
        <update>Y</update>
      </value>
      <value>
        <name>CREATE_TIME</name>
        <rename>CREATE_TIME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>CREATOR</name>
        <rename>CREATOR</rename>
        <update>Y</update>
      </value>
      <value>
        <name>MODIFY_TIME</name>
        <rename>MODIFY_TIME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>MODIFIER</name>
        <rename>MODIFIER</rename>
        <update>Y</update>
      </value>
      <value>
        <name>IS_CONTROLLED</name>
        <rename>IS_CONTROLLED</rename>
        <update>Y</update>
      </value>
      <value>
        <name>INFO_SOURCE_TYPE</name>
        <rename>V_INFO_SOURCE_TYPE</rename>
        <update>Y</update>
      </value>
      <value>
        <name>INFO_SOURCE_ID</name>
        <rename>DRUG_ID</rename>
        <update>N</update>
      </value>
    </lookup>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>729</xloc>
      <yloc>154</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>插入 / 更新IWMDS_DRUG_CLASS_STRUCT_LINK</name>
    <type>InsertUpdate</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <commit>100</commit>
    <update_bypassed>N</update_bypassed>
    <lookup>
      <schema/>
      <table>IWMDS_DRUG_CLASS_STRUCT_LINK</table>
      <key>
        <name>V_DRUG_CLASS_ID</name>
        <field>DRUG_CLASS_ID</field>
        <condition>=</condition>
        <name2/>
      </key>
      <key>
        <name>V_DRUG_CLASS_STRUCT_ID</name>
        <field>DRUG_STRUCT_ID</field>
        <condition>=</condition>
        <name2/>
      </key>
      <value>
        <name>DCSLINK_ID</name>
        <rename>V_DRUG_LINK_ID</rename>
        <update>N</update>
      </value>
      <value>
        <name>DRUG_STRUCT_ID</name>
        <rename>V_DRUG_CLASS_STRUCT_ID</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_CLASS_ID</name>
        <rename>V_DRUG_CLASS_ID</rename>
        <update>Y</update>
      </value>
      <value>
        <name>CREATE_TIME</name>
        <rename>CREATE_TIME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>MODIFIER</name>
        <rename>MODIFIER</rename>
        <update>Y</update>
      </value>
      <value>
        <name>MODIFY_TIME</name>
        <rename>MODIFY_TIME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>INFO_ORDER</name>
        <rename>INFO_ORDER</rename>
        <update>Y</update>
      </value>
      <value>
        <name>REMARKS</name>
        <rename>REMARKS</rename>
        <update>Y</update>
      </value>
      <value>
        <name>IS_DELETE</name>
        <rename>ENABLE_FLAG</rename>
        <update>Y</update>
      </value>
      <value>
        <name>CREATOR</name>
        <rename>CREATOR</rename>
        <update>Y</update>
      </value>
    </lookup>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>819</xloc>
      <yloc>417</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>插入 / 更新IWMDS_DRUG_CLASS_STRUCT_LINK 2</name>
    <type>InsertUpdate</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <commit>100</commit>
    <update_bypassed>N</update_bypassed>
    <lookup>
      <schema/>
      <table>IWMDS_DRUG_CLASS_STRUCT_LINK</table>
      <key>
        <name>V_DRUG_CLASS_ID_C</name>
        <field>DRUG_CLASS_ID</field>
        <condition>=</condition>
        <name2/>
      </key>
      <key>
        <name>V_DRUG_CLASS_STRUCT_ID</name>
        <field>DRUG_STRUCT_ID</field>
        <condition>=</condition>
        <name2/>
      </key>
      <value>
        <name>DCSLINK_ID</name>
        <rename>V_DRUG_LINK_ID</rename>
        <update>N</update>
      </value>
      <value>
        <name>DRUG_STRUCT_ID</name>
        <rename>V_DRUG_CLASS_STRUCT_ID</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_CLASS_ID</name>
        <rename>V_DRUG_CLASS_ID_C</rename>
        <update>Y</update>
      </value>
      <value>
        <name>CREATE_TIME</name>
        <rename>CREATE_TIME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>MODIFIER</name>
        <rename>MODIFIER</rename>
        <update>Y</update>
      </value>
      <value>
        <name>MODIFY_TIME</name>
        <rename>MODIFY_TIME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>INFO_ORDER</name>
        <rename>INFO_ORDER</rename>
        <update>Y</update>
      </value>
      <value>
        <name>REMARKS</name>
        <rename>REMARKS</rename>
        <update>Y</update>
      </value>
      <value>
        <name>IS_DELETE</name>
        <rename>ENABLE_FLAG</rename>
        <update>Y</update>
      </value>
      <value>
        <name>CREATOR</name>
        <rename>CREATOR</rename>
        <update>Y</update>
      </value>
    </lookup>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>520</xloc>
      <yloc>535</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>插入 / 更新IWMDS_DRUG_DETAIL</name>
    <type>InsertUpdate</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <commit>100</commit>
    <update_bypassed>N</update_bypassed>
    <lookup>
      <schema/>
      <table>IWMDS_DRUG_DETAIL</table>
      <key>
        <name>V_DRUG_CLASS_ID</name>
        <field>DRUG_ID</field>
        <condition>=</condition>
        <name2/>
      </key>
      <value>
        <name>DRUG_DETAIL_ID</name>
        <rename>V_DRUG_DETAIL_ID</rename>
        <update>N</update>
      </value>
      <value>
        <name>INFO_ORDER</name>
        <rename>INFO_ORDER</rename>
        <update>Y</update>
      </value>
      <value>
        <name>REMARKS</name>
        <rename>REMARKS</rename>
        <update>Y</update>
      </value>
      <value>
        <name>IS_DELETE</name>
        <rename>ENABLE_FLAG</rename>
        <update>Y</update>
      </value>
      <value>
        <name>CREATOR</name>
        <rename>CREATOR</rename>
        <update>Y</update>
      </value>
      <value>
        <name>CREATE_TIME</name>
        <rename>CREATE_TIME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>MODIFIER</name>
        <rename>MODIFIER</rename>
        <update>Y</update>
      </value>
      <value>
        <name>MODIFY_TIME</name>
        <rename>MODIFY_TIME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_INGREDIENT</name>
        <rename>DRUG_INGREDIENT</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_DESCRIPTION</name>
        <rename>DRUG_DESCRIPTION</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_SPECIFICATIONS</name>
        <rename>DRUG_SPECIFICATIONS</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_UNIT</name>
        <rename>DRUG_UNIT_CODE</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_NAME</name>
        <rename>DRUG_COMMON_CN_NAME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_ENGLISH_NAME</name>
        <rename>DRUG_COMMON_EN_NAME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>BRAND_NAME</name>
        <rename>DRUG_BRAND_CN_NAME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>BRAND_ENGLISH_NAME</name>
        <rename>DRUG_BRAND_EN_NAME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>IS_CONTROLLED</name>
        <rename>IS_CONTROLLED</rename>
        <update>Y</update>
      </value>
      <value>
        <name>FORM_CODE</name>
        <rename>DRUG_FORM_CODE</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_ID</name>
        <rename>V_DRUG_CLASS_ID</rename>
        <update>Y</update>
      </value>
      <value>
        <name>BASIC_CODE</name>
        <rename>DRUG_CODE</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_PINYIN</name>
        <rename>DRUG_PINYIN</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_FIRST_LETTER</name>
        <rename>DRUG_FIRST_LETTER</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_LENGTH</name>
        <rename>DRUG_LENGTH</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_HEIGHT</name>
        <rename>DRUG_HIGH</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_WIDTH</name>
        <rename>DRUG_WIDTH</rename>
        <update>Y</update>
      </value>
    </lookup>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>909</xloc>
      <yloc>552</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>插入 / 更新IWMDS_DRUG_DETAIL 2</name>
    <type>InsertUpdate</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <commit>100</commit>
    <update_bypassed>N</update_bypassed>
    <lookup>
      <schema/>
      <table>IWMDS_DRUG_DETAIL</table>
      <key>
        <name>V_DRUG_CLASS_ID_C</name>
        <field>DRUG_ID</field>
        <condition>=</condition>
        <name2/>
      </key>
      <value>
        <name>DRUG_DETAIL_ID</name>
        <rename>V_DRUG_DETAIL_ID</rename>
        <update>N</update>
      </value>
      <value>
        <name>DRUG_ID</name>
        <rename>V_DRUG_CLASS_ID_C</rename>
        <update>N</update>
      </value>
      <value>
        <name>REMARKS</name>
        <rename>REMARKS</rename>
        <update>Y</update>
      </value>
      <value>
        <name>MODIFY_TIME</name>
        <rename>MODIFY_TIME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>MODIFIER</name>
        <rename>MODIFIER</rename>
        <update>Y</update>
      </value>
      <value>
        <name>IS_CONTROLLED</name>
        <rename>IS_CONTROLLED</rename>
        <update>Y</update>
      </value>
      <value>
        <name>INFO_ORDER</name>
        <rename>INFO_ORDER</rename>
        <update>Y</update>
      </value>
      <value>
        <name>IS_DELETE</name>
        <rename>ENABLE_FLAG</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_UNIT</name>
        <rename>DRUG_UNIT_CODE</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_SPECIFICATIONS</name>
        <rename>DRUG_SPECIFICATIONS</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_INGREDIENT</name>
        <rename>DRUG_INGREDIENT</rename>
        <update>Y</update>
      </value>
      <value>
        <name>FORM_CODE</name>
        <rename>DRUG_FORM_CODE</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_DESCRIPTION</name>
        <rename>DRUG_DESCRIPTION</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_ENGLISH_NAME</name>
        <rename>DRUG_COMMON_EN_NAME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_NAME</name>
        <rename>DRUG_COMMON_CN_NAME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>BASIC_CODE</name>
        <rename>DRUG_CODE</rename>
        <update>Y</update>
      </value>
      <value>
        <name>BRAND_ENGLISH_NAME</name>
        <rename>DRUG_BRAND_EN_NAME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>BRAND_NAME</name>
        <rename>DRUG_BRAND_CN_NAME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>CREATOR</name>
        <rename>CREATOR</rename>
        <update>Y</update>
      </value>
      <value>
        <name>CREATE_TIME</name>
        <rename>CREATE_TIME</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_PINYIN</name>
        <rename>DRUG_PINYIN</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_FIRST_LETTER</name>
        <rename>DRUG_FIRST_LETTER</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_LENGTH</name>
        <rename>DRUG_LENGTH</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_HEIGHT</name>
        <rename>DRUG_HIGH</rename>
        <update>Y</update>
      </value>
      <value>
        <name>DRUG_WIDTH</name>
        <rename>DRUG_WIDTH</rename>
        <update>Y</update>
      </value>
    </lookup>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>520</xloc>
      <yloc>639</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>数据库查询V_DRUG_CLASS_ID_C</name>
    <type>DBLookup</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <cache>N</cache>
    <cache_load_all>N</cache_load_all>
    <cache_size>0</cache_size>
    <lookup>
      <schema/>
      <table>IWMDS_DRUG_CLASS</table>
      <orderby/>
      <fail_on_multiple>N</fail_on_multiple>
      <eat_row_on_failure>N</eat_row_on_failure>
      <key>
        <name>V_INFO_SOURCE_TYPE</name>
        <field>INFO_SOURCE_TYPE</field>
        <condition>=</condition>
        <name2/>
      </key>
      <key>
        <name>DRUG_ID</name>
        <field>INFO_SOURCE_ID</field>
        <condition>=</condition>
        <name2/>
      </key>
      <value>
        <name>DRUG_CLASS_ID</name>
        <rename>V_DRUG_CLASS_ID_C</rename>
        <default/>
        <type>String</type>
      </value>
    </lookup>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>521</xloc>
      <yloc>419</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>数据库查询V_DRUG_CLASS_STRUCT_ID</name>
    <type>DBLookup</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <cache>N</cache>
    <cache_load_all>N</cache_load_all>
    <cache_size>0</cache_size>
    <lookup>
      <schema/>
      <table>IWMDS_DRUG_CLASS_STRUCT</table>
      <orderby/>
      <fail_on_multiple>N</fail_on_multiple>
      <eat_row_on_failure>N</eat_row_on_failure>
      <key>
        <name>V_INFO_SOURCE_TYPE</name>
        <field>INFO_SOURCE_TYPE</field>
        <condition>=</condition>
        <name2/>
      </key>
      <key>
        <name>DRUG_STRUCT_ID</name>
        <field>INFO_SOURCE_ID</field>
        <condition>=</condition>
        <name2/>
      </key>
      <value>
        <name>STRUCT_ID</name>
        <rename>V_DRUG_CLASS_STRUCT_ID</rename>
        <default/>
        <type>String</type>
      </value>
    </lookup>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>378</xloc>
      <yloc>40</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>更新 IWMDS_DRUG_BATCH</name>
    <type>Update</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <skip_lookup>N</skip_lookup>
    <commit>100</commit>
    <use_batch>N</use_batch>
    <error_ignored>Y</error_ignored>
    <ignore_flag_field/>
    <lookup>
      <schema/>
      <table>IWMDS_DRUG_BATCH</table>
      <key>
        <name>DRUG_ID</name>
        <field>ATTRIBUTE09</field>
        <condition>=</condition>
        <name2/>
        </key>
      <value>
        <name>DRUG_DETAIL_ID</name>
        <rename>V_DRUG_DETAIL_ID</rename>
        </value>
      <value>
        <name>MODIFY_TIME</name>
        <rename>V_CURRENT_TIME</rename>
        </value>
      </lookup>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>1115</xloc>
      <yloc>395</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>更新 IWMDS_PRESCRIPTION_DETAIL</name>
    <type>Update</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <skip_lookup>N</skip_lookup>
    <commit>100</commit>
    <use_batch>N</use_batch>
    <error_ignored>Y</error_ignored>
    <ignore_flag_field/>
    <lookup>
      <schema/>
      <table>IWMDS_PRESCRIPTION_DETAIL</table>
      <key>
        <name>DRUG_ID</name>
        <field>ATTRIBUTE09</field>
        <condition>=</condition>
        <name2/>
        </key>
      <value>
        <name>DETAIL_ID</name>
        <rename>V_DRUG_DETAIL_ID</rename>
        </value>
      <value>
        <name>MODIFY_TIME</name>
        <rename>V_CURRENT_TIME</rename>
        </value>
      </lookup>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>1116</xloc>
      <yloc>558</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>表输入</name>
    <type>TableInput</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <sql>SELECT
  DRUG_ID
, DRUG_CODE
, DRUG_COMMON_CN_NAME
, DRUG_COMMON_EN_NAME
, IS_CONTROLLED
, DRUG_BRAND_CN_NAME
, DRUG_BRAND_EN_NAME
, DRUG_FORM_CODE
, DRUG_UNIT_CODE
, DRUG_SPECIFICATIONS
, DRUG_DESCRIPTION
, DRUG_INGREDIENT
, DRUG_STRUCT_ID
, INFO_ORDER
, DRUG_LENGTH
, DRUG_HIGH
, DRUG_WIDTH
, REMARKS
, ENABLE_FLAG
, CREATOR
, to_date(create_time,‘yyyy-mm-dd hh24:mi:ss‘) CREATE_TIME
, MODIFIER
, to_date(MODIFY_TIME,‘yyyy-mm-dd hh24:mi:ss‘) MODIFY_TIME
, ATTRIBUTE01
, ATTRIBUTE02
, ATTRIBUTE03
, ATTRIBUTE04
, ATTRIBUTE05
, DRUG_PINYIN || ‘,‘ || f_getFirstOrFullSpell(drug_common_cn_name,1) ||‘,‘||f_getFirstOrFullSpell(DRUG_BRAND_CN_NAME,1) DRUG_PINYIN
, DRUG_FIRST_LETTER || ‘,‘||f_getFirstOrFullSpell(drug_common_cn_name) ||‘,‘ || f_getFirstOrFullSpell(DRUG_BRAND_CN_NAME) DRUG_FIRST_LETTER,
  SYSDATE V_CURRENT_TIME
FROM HIS_DRUG
</sql>
    <limit>0</limit>
    <lookup/>
    <execute_each_row>N</execute_each_row>
    <variables_active>N</variables_active>
    <lazy_conversion_active>N</lazy_conversion_active>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>144</xloc>
      <yloc>37</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>调用DB存储过程V_DRUG_CLASS_COUNT</name>
    <type>DBProc</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <procedure>F_SYNC_GET_DRUG_CLASS_COUNT</procedure>
    <lookup>
      <arg>
        <name>DRUG_ID</name>
        <direction>IN</direction>
        <type>String</type>
      </arg>
    </lookup>
    <result>
      <name>V_DRUG_CLASS_COUNT</name>
      <type>String</type>
    </result>
    <auto_commit>Y</auto_commit>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>729</xloc>
      <yloc>40</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>调用DB存储过程V_DRUG_CLASS_ID</name>
    <type>DBProc</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <procedure>CREATEGUID</procedure>
    <lookup>
    </lookup>
    <result>
      <name>V_DRUG_CLASS_ID</name>
      <type>String</type>
    </result>
    <auto_commit>Y</auto_commit>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>137</xloc>
      <yloc>227</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>调用DB存储过程V_DRUG_DETAIL_ID</name>
    <type>DBProc</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <procedure>CREATEGUID</procedure>
    <lookup>
    </lookup>
    <result>
      <name>V_DRUG_DETAIL_ID</name>
      <type>String</type>
    </result>
    <auto_commit>Y</auto_commit>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>135</xloc>
      <yloc>439</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>调用DB存储过程V_DRUG_LINK_ID</name>
    <type>DBProc</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>serverConn</connection>
    <procedure>CREATEGUID</procedure>
    <lookup>
    </lookup>
    <result>
      <name>V_DRUG_LINK_ID</name>
      <type>String</type>
    </result>
    <auto_commit>Y</auto_commit>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>137</xloc>
      <yloc>318</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>过滤记录</name>
    <type>FilterRows</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
<send_true_to>插入 / 更新IWMDS_DRUG_CLASS_STRUCT_LINK</send_true_to>
<send_false_to>数据库查询V_DRUG_CLASS_ID_C</send_false_to>
    <compare>
<condition>
 <negated>N</negated>
 <leftvalue>V_DRUG_CLASS_COUNT</leftvalue>
 <function>=</function>
 <rightvalue/>
 <value><name>constant</name><type>String</type><text>0</text><length>-1</length><precision>-1</precision><isnull>N</isnull><mask/></value> </condition>
    </compare>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>728</xloc>
      <yloc>268</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step_error_handling>
  </step_error_handling>
   <slave-step-copy-partition-distribution>
</slave-step-copy-partition-distribution>
   <slave_transformation>N</slave_transformation>
</transformation>


Kettle同步设计思路,布布扣,bubuko.com

Kettle同步设计思路

标签:kettle   同步   

原文地址:http://blog.csdn.net/fengshuiyue/article/details/25858693

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!