Announcement

Collapse
No announcement yet.

tables of database

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • tables of database

    I need to know which are the tables or instructions to write a message llp in the database mirth
    Thank you

  • #2
    Re: tables of database

    Please refer to the samples in File Repository / Channels / Inbound Channels:

    http://www.mirthproject.org/index.ph...d=26&Itemid=43

    The samples should help get familiar with using filter and transformer to get the data from an Inbound LLP message and INSERT/UPDATE tables in the database.

    Hope it helps.

    Comment


    • #3
      Re: tables of database

      I have installed to me thedatabase of the mirth but in the examples that it is to insert in the database itputs the patient table and does not exist in the base of information

      Comment


      • #4
        Re: tables of database

        The table need to be created in the destination database.

        For e.g., the File Repository samples show how to get patient's last name, first name, middle name, data of bitrth, phone number, SSN etc. and store it in the database using an INSERT statement or by calling a stored procedure.

        You need to create a table called PATIENT in your database with the columns for last name, first name, middle name, data of bitrth, phone number, SSN etc. and use the INSERT statment (or stored procedure) similar to the one shown in the sample.

        Hope it helps!

        Comment


        • #5
          Re: tables of database

          With the program llp hl7browser0.9.5.jar that said to me ,
          I am ordering the messages that I have stooped example to mirth but the program llp does
          not admit me ADT-A04.hl7 and then it I cannot insert in the database the message if that me admits it
          but It does not cost me
          . You can say to me for that itdoes not recognize the message

          Comment


          • #6
            Re: tables of database

            Can you check the mirth.log file and post the error message, if any?

            Thanks!

            Comment


            • #7
              Re: tables of database

              In mirth.log

              INFO 2007-03-21 08:16:34,593 [Thread-0] com.webreach.mirth.server.Mirth: starting mirth server...
              INFO 2007-03-21 11:55:37,218 [a5190508-0892-49c7-98fc-50bfb7bb22a0_destination_1_connector.dispatcher.1] filter: Not an A01, A04, A08, A10, A28, or A31 message - Msg. ignored
              INFO 2007-03-21 11:57:20,406 [a5190508-0892-49c7-98fc-50bfb7bb22a0_destination_1_connector.dispatcher.2] filter: Not an A01, A04, A08, A10, A28, or A31 message - Msg. ignored
              INFO 2007-03-21 12:00:53,125 [a5190508-0892-49c7-98fc-50bfb7bb22a0_destination_1_connector.dispatcher.3] filter: Not an A01, A04, A08, A10, A28, or A31 message - Msg. ignored

              isn't recognize the message ADT-A04.hl7. but I donĀ“t know.

              Comment


              • #8
                Re: tables of database

                after


                ERROR 2007-03-21 14:20:55,593 [a5190508-0892-49c7-98fc-50bfb7bb22a0.3] org.mule.impl.DefaultComponentExceptionStrategy: Caught exception in Exception Strategy for: a5190508-0892-49c7-98fc-50bfb7bb22a0: org.mule.umo.MessagingException: Failed to invoke UMO Component: a5190508-0892-49c7-98fc-50bfb7bb22a0. Message payload is of type: java.lang.String
                org.mule.umo.MessagingException: Failed to invoke UMO Component: a5190508-0892-49c7-98fc-50bfb7bb22a0. Message payload is of type: java.lang.String
                at org.mule.impl.DefaultLifecycleAdapter.onCall(Defau ltLifecycleAdapter.java:193)
                at org.mule.impl.DefaultLifecycleAdapter.intercept(De faultLifecycleAdapter.java:232)
                at org.mule.impl.InterceptorsInvoker.execute(Intercep torsInvoker.java:53)
                at org.mule.impl.model.DefaultMuleProxy.run(DefaultMu leProxy.java:388)
                at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
                at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
                at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
                at java.lang.Thread.run(Unknown Source)
                Caused by: org.mule.umo.transformer.TransformerException: null (java.lang.NullPointerException)
                at com.webreach.mirth.server.mule.transformers.HL7ToM essageObject.doTransform(HL7ToMessageObject.java:9 4)
                at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
                at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:200)
                at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
                at org.mule.impl.MuleEventContext.getTransformedMessa ge(MuleEventContext.java:100)
                at com.webreach.mirth.server.mule.components.Channel. onCall(Channel.java:34)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.mule.model.DynamicEntryPoint.invokeCurrent(Dyn amicEntryPoint.java:168)
                at org.mule.model.DynamicEntryPoint.invoke(DynamicEnt ryPoint.java:90)
                at org.mule.impl.DefaultLifecycleAdapter.onCall(Defau ltLifecycleAdapter.java:177)
                ... 7 more
                Caused by: java.lang.NullPointerException
                at com.webreach.mirth.server.mule.transformers.HL7ToM essageObject.doTransform(HL7ToMessageObject.java:7 4)
                ... 19 more
                ERROR 2007-03-21 14:20:55,609 [a5190508-0892-49c7-98fc-50bfb7bb22a0.4] org.mule.impl.DefaultComponentExceptionStrategy: Caught exception in Exception Strategy for: a5190508-0892-49c7-98fc-50bfb7bb22a0: org.mule.umo.MessagingException: Failed to invoke UMO Component: a5190508-0892-49c7-98fc-50bfb7bb22a0. Message payload is of type: java.lang.String
                org.mule.umo.MessagingException: Failed to invoke UMO Component: a5190508-0892-49c7-98fc-50bfb7bb22a0. Message payload is of type: java.lang.String
                at org.mule.impl.DefaultLifecycleAdapter.onCall(Defau ltLifecycleAdapter.java:193)
                at org.mule.impl.DefaultLifecycleAdapter.intercept(De faultLifecycleAdapter.java:232)
                at org.mule.impl.InterceptorsInvoker.execute(Intercep torsInvoker.java:53)
                at org.mule.impl.model.DefaultMuleProxy.run(DefaultMu leProxy.java:388)
                at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
                at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
                at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
                at java.lang.Thread.run(Unknown Source)
                Caused by: org.mule.umo.transformer.TransformerException: null (java.lang.NullPointerException)
                at com.webreach.mirth.server.mule.transformers.HL7ToM essageObject.doTransform(HL7ToMessageObject.java:9 4)
                at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
                at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:200)
                at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
                at org.mule.impl.MuleEventContext.getTransformedMessa ge(MuleEventContext.java:100)
                at com.webreach.mirth.server.mule.components.Channel. onCall(Channel.java:34)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.mule.model.DynamicEntryPoint.invokeCurrent(Dyn amicEntryPoint.java:168)
                at org.mule.model.DynamicEntryPoint.invoke(DynamicEnt ryPoint.java:90)
                at org.mule.impl.DefaultLifecycleAdapter.onCall(Defau ltLifecycleAdapter.java:177)
                ... 7 more
                Caused by: java.lang.NullPointerException
                at com.webreach.mirth.server.mule.transformers.HL7ToM essageObject.doTransform(HL7ToMessageObject.java:7 4)
                ... 19 more
                ERROR 2007-03-21 14:20:55,625 [a5190508-0892-49c7-98fc-50bfb7bb22a0.5] org.mule.impl.DefaultComponentExceptionStrategy: Caught exception in Exception Strategy for: a5190508-0892-49c7-98fc-50bfb7bb22a0: org.mule.umo.MessagingException: Failed to invoke UMO Component: a5190508-0892-49c7-98fc-50bfb7bb22a0. Message payload is of type: java.lang.String
                org.mule.umo.MessagingException: Failed to invoke UMO Component: a5190508-0892-49c7-98fc-50bfb7bb22a0. Message payload is of type: java.lang.String
                at org.mule.impl.DefaultLifecycleAdapter.onCall(Defau ltLifecycleAdapter.java:193)
                at org.mule.impl.DefaultLifecycleAdapter.intercept(De faultLifecycleAdapter.java:232)
                at org.mule.impl.InterceptorsInvoker.execute(Intercep torsInvoker.java:53)
                at org.mule.impl.model.DefaultMuleProxy.run(DefaultMu leProxy.java:388)
                at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
                at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
                at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
                at java.lang.Thread.run(Unknown Source)
                Caused by: org.mule.umo.transformer.TransformerException: null (java.lang.NullPointerException)
                at com.webreach.mirth.server.mule.transformers.HL7ToM essageObject.doTransform(HL7ToMessageObject.java:9 4)
                at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
                at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:200)
                at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
                at org.mule.impl.MuleEventContext.getTransformedMessa ge(MuleEventContext.java:100)
                at com.webreach.mirth.server.mule.components.Channel. onCall(Channel.java:34)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.mule.model.DynamicEntryPoint.invokeCurrent(Dyn amicEntryPoint.java:168)
                at org.mule.model.DynamicEntryPoint.invoke(DynamicEnt ryPoint.java:90)
                at org.mule.impl.DefaultLifecycleAdapter.onCall(Defau ltLifecycleAdapter.java:177)
                ... 7 more
                Caused by: java.lang.NullPointerException
                at com.webreach.mirth.server.mule.transformers.HL7ToM essageObject.doTransform(HL7ToMessageObject.java:7 4)
                ... 19 more
                ERROR 2007-03-21 14:20:55,687 [a5190508-0892-49c7-98fc-50bfb7bb22a0.10] org.mule.impl.DefaultComponentExceptionStrategy: Caught exception in Exception Strategy for: a5190508-0892-49c7-98fc-50bfb7bb22a0: org.mule.umo.MessagingException: Failed to invoke UMO Component: a5190508-0892-49c7-98fc-50bfb7bb22a0. Message payload is of type: java.lang.String
                org.mule.umo.MessagingException: Failed to invoke UMO Component: a5190508-0892-49c7-98fc-50bfb7bb22a0. Message payload is of type: java.lang.String
                at org.mule.impl.DefaultLifecycleAdapter.onCall(Defau ltLifecycleAdapter.java:193)
                at org.mule.impl.DefaultLifecycleAdapter.intercept(De faultLifecycleAdapter.java:232)
                at org.mule.impl.InterceptorsInvoker.execute(Intercep torsInvoker.java:53)
                at org.mule.impl.model.DefaultMuleProxy.run(DefaultMu leProxy.java:388)
                at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
                at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
                at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
                at java.lang.Thread.run(Unknown Source)
                Caused by: org.mule.umo.transformer.TransformerException: null (java.lang.NullPointerException)
                at com.webreach.mirth.server.mule.transformers.HL7ToM essageObject.doTransform(HL7ToMessageObject.java:9 4)
                at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
                at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:200)
                at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
                at org.mule.impl.MuleEventContext.getTransformedMessa ge(MuleEventContext.java:100)
                at com.webreach.mirth.server.mule.components.Channel. onCall(Channel.java:34)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.mule.model.DynamicEntryPoint.invokeCurrent(Dyn amicEntryPoint.java:168)
                at org.mule.model.DynamicEntryPoint.invoke(DynamicEnt ryPoint.java:90)
                at org.mule.impl.DefaultLifecycleAdapter.onCall(Defau ltLifecycleAdapter.java:177)
                ... 7 more
                Caused by: java.lang.NullPointerException
                at com.webreach.mirth.server.mule.transformers.HL7ToM essageObject.doTransform(HL7ToMessageObject.java:7 4)
                ... 19 more
                ERROR 2007-03-21 14:20:55,687 [a5190508-0892-49c7-98fc-50bfb7bb22a0.7] org.mule.impl.DefaultComponentExceptionStrategy: Caught exception in Exception Strategy for: a5190508-0892-49c7-98fc-50bfb7bb22a0: org.mule.umo.MessagingException: Failed to invoke UMO Component: a5190508-0892-49c7-98fc-50bfb7bb22a0. Message payload is of type: java.lang.String
                org.mule.umo.MessagingException: Failed to invoke UMO Component: a5190508-0892-49c7-98fc-50bfb7bb22a0. Message payload is of type: java.lang.String
                at org.mule.impl.DefaultLifecycleAdapter.onCall(Defau ltLifecycleAdapter.java:193)
                at org.mule.impl.DefaultLifecycleAdapter.intercept(De faultLifecycleAdapter.java:232)
                at org.mule.impl.InterceptorsInvoker.execute(Intercep torsInvoker.java:53)
                at org.mule.impl.model.DefaultMuleProxy.run(DefaultMu leProxy.java:388)
                at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
                at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
                at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
                at java.lang.Thread.run(Unknown Source)
                Caused by: org.mule.umo.transformer.TransformerException: null (java.lang.NullPointerException)
                at com.webreach.mirth.server.mule.transformers.HL7ToM essageObject.doTransform(HL7ToMessageObject.java:9 4)
                at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
                at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:200)
                at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
                at org.mule.impl.MuleEventContext.getTransformedMessa ge(MuleEventContext.java:100)
                at com.webreach.mirth.server.mule.components.Channel. onCall(Channel.java:34)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.mule.model.DynamicEntryPoint.invokeCurrent(Dyn amicEntryPoint.java:168)
                at org.mule.model.DynamicEntryPoint.invoke(DynamicEnt ryPoint.java:90)
                at org.mule.impl.DefaultLifecycleAdapter.onCall(Defau ltLifecycleAdapter.java:177)
                ... 7 more
                Caused by: java.lang.NullPointerException
                at com.webreach.mirth.server.mule.transformers.HL7ToM essageObject.doTransform(HL7ToMessageObject.java:7 4)
                ... 19 more
                ERROR 2007-03-21 14:20:55,687 [a5190508-0892-49c7-98fc-50bfb7bb22a0.2] org.mule.impl.DefaultComponentExceptionStrategy: Caught exception in Exception Strategy for: a5190508-0892-49c7-98fc-50bfb7bb22a0: org.mule.umo.MessagingException: Failed to invoke UMO Component: a5190508-0892-49c7-98fc-50bfb7bb22a0. Message payload is of type: java.lang.String
                org.mule.umo.MessagingException: Failed to invoke UMO Component: a5190508-0892-49c7-98fc-50bfb7bb22a0. Message payload is of type: java.lang.String
                at org.mule.impl.DefaultLifecycleAdapter.onCall(Defau ltLifecycleAdapter.java:193)
                at org.mule.impl.DefaultLifecycleAdapter.intercept(De faultLifecycleAdapter.java:232)
                at org.mule.impl.InterceptorsInvoker.execute(Intercep torsInvoker.java:53)
                at org.mule.impl.model.DefaultMuleProxy.run(DefaultMu leProxy.java:388)
                at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
                at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
                at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
                at java.lang.Thread.run(Unknown Source)
                Caused by: org.mule.umo.transformer.TransformerException: null (java.lang.NullPointerException)
                at com.webreach.mirth.server.mule.transformers.HL7ToM essageObject.doTransform(HL7ToMessageObject.java:9 4)
                at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
                at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:200)
                at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
                at org.mule.impl.MuleEventContext.getTransformedMessa ge(MuleEventContext.java:100)
                at com.webreach.mirth.server.mule.components.Channel. onCall(Channel.java:34)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.mule.model.DynamicEntryPoint.invokeCurrent(Dyn amicEntryPoint.java:168)
                at org.mule.model.DynamicEntryPoint.invoke(DynamicEnt ryPoint.java:90)
                at org.mule.impl.DefaultLifecycleAdapter.onCall(Defau ltLifecycleAdapter.java:177)
                ... 7 more
                Caused by: java.lang.NullPointerException
                at com.webreach.mirth.server.mule.transformers.HL7ToM essageObject.doTransform(HL7ToMessageObject.java:7 4)
                ... 19 more

                Comment


                • #9
                  Re: tables of database

                  Looks like you have a filter for processing only A01, A04, A08, A10, or an A31 message and the incoming message is not of this type. What is the sample message you are trying to send to the LLP channel? You should be able to see the received messages in the Mirth Administrator. Click on Status, on the right pane, select the channel, right-click / View Messages. Check the type of message it received. If possible, can you post (copy and paste) the incoming message?

                  Comment


                  • #10
                    Re: tables of database

                    MSH|^~\&|Mirth|1|||2006044535||ADT^A04|603340|D|2. 3.1
                    EVN|A04|20060404090742
                    PID|1|800888^^^Mirth^PN|999945682^^^AccMgr^MR^1||T EST^PATIENT MF||19570414|M||W|21 PALM MANOR^^EAST SYRACUSE^NY^130570000^^M|31|||E|M||6635130^^^Mirth ^VN^1|000987655|||2|||||NOT A VETERAN|||N
                    PD1||||1335^ALCOTT^KAREN^^^^^^AccMgr^^^^CI|||I
                    NK1|1|TEST^MARGARET|W|21 PALM MANOR^^EAST SYRACUSE^NY^130570000|||Y
                    The message is that of the example and me it does not recognize it , this name is ADT-A04.hl7

                    PV1|1|E|ED^^^1|1|||1281^MARKHAM^JOSEPH^^^^^^AccMgr ^^^^CI|1281^LANG^JOE^^^^^^Mirth^^^^CI||ED||||7|S|| |62|6635130^^^AccMgr^VN^1|865^SP KOPP|||||||||||||||||||1||A|||20060404090500
                    PV2||^NO||||||20060404090500|||||||||||||||||||||| ||||||||S
                    DG1|1||^HEADACHE|HEADACHE||A|||||||||0
                    GT1|1|382582|TEST^PATIENT MF||21 PALM MANOR^^EAST SYRACUSE^NY^130570000|||19570414|M|||000987655|||| ||||11
                    IN1|1|SELF PAY NYS|734|SELF PAY NYS|||||||||||5|TEST^PATIENT MF|1|19570414|21 PALM MANOR^^EAST SYRACUSE^NY^130570000|||||||||||||||||||||||11|M|| ||||382582
                    IN1|2|SELF PAY|705|SELFPAY|||||||||||5||1
                    IN2|1||000987655

                    Comment


                    • #11
                      Re: tables of database

                      The message is that of the example and me it does not recognize it , this name is ADT-A04.hl7

                      Comment


                      • #12
                        Re: tables of database

                        Can you post your channel?

                        Comment


                        • #13
                          Re: tables of database

                          this is the channel



                          <com.webreach.mirth.model.Channel>
                          <id>a5190508-0892-49c7-98fc-50bfb7bb22a0</id>
                          <name>MirthHL7Test</name>
                          <description></description>
                          <enabled>true</enabled>
                          <version>1.3.2</version>
                          <revision>25</revision>
                          <direction>INBOUND</direction>
                          <protocol>HL7</protocol>
                          <mode>ROUTER</mode>
                          <sourceConnector>
                          <name>sourceConnector</name>
                          <properties>
                          <property name="messageEnd">0x1C</property>
                          <property name="ackCodeError">AE</property>
                          <property name="messageStart">0x0B</property>
                          <property name="ackMsgRejected">Message Rejected.</property>
                          <property name="ackCodeRejected">AR</property>
                          <property name="receiveTimeout">5000</property>
                          <property name="charEncoding">hex</property>
                          <property name="bufferSize">65536</property>
                          <property name="sendACK">0</property>
                          <property name="port">6661</property>
                          <property name="ackMsgSuccessful"></property>
                          <property name="tcpProtocolClassName">org.mule.providers.tcp .protocols.LlpProtocol</property>
                          <property name="segmentEnd">0x0D</property>
                          <property name="charsetEncoding">DEFAULT_ENCODING</property>
                          <property name="keepSendSocketOpen">0</property>
                          <property name="host">172.17.0.218</property>
                          <property name="DataType">LLP Listener</property>
                          <property name="ackMsgError">An Error Occured Processing Message.</property>
                          <property name="ackCodeSuccessful">AA</property>
                          <property name="recordSeparator">0x0D</property>
                          </properties>
                          <transformer>
                          <steps/>
                          </transformer>
                          <filter>
                          <rules/>
                          </filter>
                          <transportName>LLP Listener</transportName>
                          </sourceConnector>
                          <destinationConnectors>
                          <com.webreach.mirth.model.Connector>
                          <name>PatientTable</name>
                          <properties>
                          <property name="URL">jdbcostgresql://172.17.0.218:5432/mirth</property>
                          <property name="DataType">Database Writer</property>
                          <property name="password">medic123</property>
                          <property name="host">query</property>
                          <property name="driver">org.postgresql.Driver</property>
                          <property name="query">INSERT IGNORE INTO PATIENT (Account)
                          SELECT &apos;Fake Insert&apos; WHERE 1 = 0
                          &#x0D;
                          &#x0D;
                          </property>
                          <property name="username">postgres</property>
                          </properties>
                          <transformer>
                          <steps>
                          <com.webreach.mirth.model.Step>
                          <sequenceNumber>0</sequenceNumber>
                          <name>Call stored proc spHL7AddOrUpdatePatient</name>
                          <script>var tempAcct = &quot;NULL&quot;;
                          var tempPrefix = &quot;NULL&quot;;
                          var tempFirstName = &quot;NULL&quot;;
                          var tempLastName = &quot;NULL&quot;;
                          var tempMiddleName = &quot;NULL&quot;;
                          var tempSuffix = &quot;NULL&quot;;
                          var tempBirthDate = &quot;NULL&quot;;
                          var tempGender = &quot;NULL&quot;;
                          var tempAddress1 = &quot;NULL&quot;;
                          var tempAddress2 = &quot;NULL&quot;;
                          var tempCity = &quot;NULL&quot;;
                          var tempState = &quot;NULL&quot;;
                          var tempZipCode = &quot;NULL&quot;;
                          var tempPhone1 = &quot;NULL&quot;;
                          var tempPhone1Type = &quot;NULL&quot;;
                          var tempPhone2 = &quot;NULL&quot;;
                          var tempPhone2Type = &quot;NULL&quot;;
                          var tempDeathDate = &quot;NULL&quot;;
                          var tempModifiedSSN = &quot;NULL&quot;;

                          // External patient account number
                          if (msg[&apos;PID&apos;][&apos;PID.3&apos;][&apos;CX.1&apos;].toString() != null) {
                          tempAcct = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.3&apos;][&apos;CX.1&apos;].toString() + &quot;&apos;&quot;;
                          }
                          // Patient name prefix
                          if (msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.5&apos;].toString() != null) {
                          tempPrefix = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.5&apos;].toString() + &quot;&apos;&quot;;
                          }
                          // Patient first name
                          if (msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.2&apos;].toString() != null) {
                          tempFirstName = msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.2&apos;].toString().toString();
                          // Doubleup single quote for names link O&apos;Brian
                          tempFirstName = tempFirstName.replace(/&apos;/g, &quot;&apos;&apos;&quot;
                          // SQL Server stored proc expects varchar parameters to be passed within single quotes
                          tempFirstName = &quot;&apos;&quot; + tempFirstName + &quot;&apos;&quot;;
                          }
                          // Patient last name
                          if (msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.1&apos;].toString() != null) {
                          tempLastName = msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.1&apos;].toString().toString();
                          // Doubleup single quote for names link O&apos;Brian
                          tempLastName = tempLastName.replace(/&apos;/g, &quot;&apos;&apos;&quot;
                          // SQL Server stored proc expects varchar parameters to be passed within single quotes
                          tempLastName = &quot;&apos;&quot; + tempLastName + &quot;&apos;&quot;;
                          }
                          // Patient middle name
                          if (msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.3&apos;].toString() != null) {
                          tempMiddleName = msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.3&apos;].toString().toString();
                          // Doubleup single quote for names link O&apos;Brian
                          tempMiddleName = tempMiddleName.replace(/&apos;/g, &quot;&apos;&apos;&quot;
                          // SQL Server stored proc expects varchar parameters to be passed within single quotes
                          tempMiddleName = &quot;&apos;&quot; + tempMiddleName + &quot;&apos;&quot;;
                          }
                          // Patient name suffix
                          if (msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.4&apos;].toString() != null) {
                          tempSuffix = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.4&apos;].toString() + &quot;&apos;&quot;;
                          }
                          // Patient birth date
                          if (msg[&apos;PID&apos;][&apos;PID.7&apos;][&apos;TS.1&apos;].toString() != null) {
                          // Get birth date in mm/dd/yyyy format
                          var dob = msg[&apos;PID&apos;][&apos;PID.7&apos;][&apos;TS.1&apos;].toString();
                          var ar = dob.match(/(\d\d\d\d)(\d\d)(\d\d)/);
                          tempBirthDate = RegExp.$2 + &apos;/&apos; + RegExp.$3 + &apos;/&apos; + RegExp.$1;
                          tempBirthDate = &quot;&apos;&quot; + tempBirthDate + &quot;&apos;&quot;;
                          }
                          // Patient gender
                          if (msg[&apos;PID&apos;][&apos;PID.8&apos;].toString() != null) {
                          tempGender = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.8&apos;].toString() + &quot;&apos;&quot;;
                          }
                          // Patient address1
                          if (msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.1&apos;].toString() != null) {
                          tempAddress1 = msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.1&apos;].toString().toString();
                          // Doubleup single quote for address like St.Peter&apos;s Hospital Rd
                          tempAddress1 = tempAddress1.replace(/&apos;/g, &quot;&apos;&apos;&quot;
                          // SQL Server stored proc expects varchar parameters to be passed within single quotes
                          tempAddress1 = &quot;&apos;&quot; + tempAddress1 + &quot;&apos;&quot;;
                          }
                          // Patient address2
                          if (msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.2&apos;].toString() != null) {
                          tempAddress2 = msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.2&apos;].toString().toString();
                          // Doubleup single quote for address like St.Peter&apos;s Hospital Rd
                          tempAddress2 = tempAddress2.replace(/&apos;/g, &quot;&apos;&apos;&quot;
                          // SQL Server stored proc expects varchar parameters to be passed within single quotes
                          tempAddress2 = &quot;&apos;&quot; + tempAddress2 + &quot;&apos;&quot;;
                          }
                          // Patient city
                          if (msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.3&apos;].toString() != null) {
                          tempCity = msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.3&apos;].toString().toString();
                          // Doubleup single quote in case city name has a single quote
                          tempCity = tempCity.replace(/&apos;/g, &quot;&apos;&apos;&quot;
                          // SQL Server stored proc expects varchar parameters to be passed within single quotes
                          tempCity = &quot;&apos;&quot; + tempCity + &quot;&apos;&quot;;
                          }
                          // Patient state
                          if (msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.4&apos;].toString() != null) {
                          tempState = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.4&apos;].toString() + &quot;&apos;&quot;;
                          }

                          // Patient zipcode
                          if (msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.5&apos;].toString() != null) {
                          tempZipCode = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.5&apos;].toString() + &quot;&apos;&quot;;
                          }

                          // Get patient&apos;s phone1 w/o &quot;( )&quot; or &quot;-&quot;
                          var tempPhone1AreaCode = &quot;&quot;;
                          var tempPhone1Number = &quot;&quot;;
                          // Patient phone1 - area code
                          if (msg[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XAD.6&apos;].toString() != null) {
                          tempPhone1AreaCode = msg[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.6&apos;].toString();
                          }
                          // Patient phone1 - phone number
                          if (msg[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.7&apos;].toString() != null) {
                          tempPhone1Number = msg[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.7&apos;].toString();
                          }
                          if (tempPhone1AreaCode != &quot;&quot {
                          tempPhone1 = &quot;&apos;&quot; + tempPhone1AreaCode + tempPhone1Number + &quot;&apos;&quot;;
                          }
                          else {
                          tempPhone1 = &quot;&apos;&quot; + tempPhone1Number + &quot;&apos;&quot;;
                          }
                          // Patient phone1 type
                          if (msg[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.9&apos;].toString() != null) {
                          tempPhone1Type = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.9&apos;].toString() + &quot;&apos;&quot;;
                          }

                          // Get patient&apos;s phone2 w/o &quot;( )&quot; or &quot;-&quot;
                          var tempPhone2AreaCode = &quot;&quot;;
                          var tempPhone2Number = &quot;&quot;;
                          // Patient phone2 - area code
                          if (msg[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XAD.6&apos;].toString() != null) {
                          tempPhone2AreaCode = msg[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.6&apos;].toString();
                          }
                          // Patient phone2 - phone number
                          if (msg[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.7&apos;].toString() != null) {
                          tempPhone2Number = msg[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.7&apos;].toString();
                          }
                          if (tempPhone2AreaCode != &quot;&quot {
                          tempPhone2 = &quot;&apos;&quot; + tempPhone2AreaCode + tempPhone2Number + &quot;&apos;&quot;;
                          }
                          else {
                          tempPhone2 = &quot;&apos;&quot; + tempPhone2Number + &quot;&apos;&quot;;
                          }
                          // Patient phone2 type
                          if (msg[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.9&apos;].toString() != null) {
                          tempPhone2Type = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.9&apos;].toString() + &quot;&apos;&quot;;
                          }

                          // Get patient&apos;s death date in mm/dd/yyyy format
                          if (msg[&apos;PID&apos;][&apos;PID.29&apos;][&apos;TS.1&apos;].toString() != null) {
                          var deathDate = msg[&apos;PID&apos;][&apos;PID.29&apos;][&apos;TS.1&apos;].toString();
                          if (deathDate != null) {
                          var ar = deathDate.match(/(\d\d\d\d)(\d\d)(\d\d)/);
                          tempDeathDate = RegExp.$2 + &apos;/&apos; + RegExp.$3 + &apos;/&apos; + RegExp.$1;
                          tempDeathDate = &quot;&apos;&quot; + tempDeathDate + &quot;&apos;&quot;;
                          }
                          }

                          // Get patient SSN with &quot;-&quot; removed
                          if (msg[&apos;PID&apos;][&apos;PID.19&apos;].toString() != null) {
                          tempSSN = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.19&apos;].toString().toString() + &quot;&apos;&quot;;
                          tempModifiedSSN = tempSSN.replace(/-/g, &quot;&quot;
                          }

                          //DatabaseConnection
                          var dbConn = DatabaseConnectionFactory.createDatabaseConnection (globalMap.get(&apos;jdbcDriver&apos, globalMap.get(&apos;dbAddress&apos, globalMap.get(&apos;dbLogin&apos, globalMap.get(&apos;dbPassword&apos);

                          //Get parameters for the stored proc separated by ,
                          // Stored proc call will look like &quot;EXEC spHL7AddOrUpdatePatient &apos;1234&apos;, &apos;Mr&apos;, &apos;TestFN&apos;, ..., &apos;111223333&apos;&quot;;
                          var spParams = tempAcct + &apos;, &apos; + tempPrefix + &apos;, &apos; +
                          tempFirstName + &apos;, &apos; + tempMiddleName + &apos;, &apos; +
                          tempLastName + &apos;, &apos; + tempSuffix + &apos;, &apos; +
                          tempAddress1 + &apos;, &apos; + tempAddress2 + &apos;, &apos; +
                          tempCity + &apos;, &apos; + tempState + &apos;, &apos; +
                          tempZipCode + &apos;, &apos; + tempPhone1 + &apos;, &apos; +
                          tempPhone1Type + &apos;, &apos; + tempPhone2 + &apos;, &apos; +
                          tempPhone2Type + &apos;, &apos; + tempGender + &apos;, &apos; +
                          tempBirthDate + &apos;, &apos; + tempDeathDate + &apos;, &apos; +
                          tempModifiedSSN;

                          var expression = &quot;EXEC spHL7AddOrUpdatePatient &quot; + spParams;
                          // Print the SQL statement for debugging purpose
                          logger.info(&apos;SQL: &apos; + expression);
                          var result = dbConn.executeCachedQuery(expression);
                          //go to the first result
                          result.next();
                          //get the value from the first column as an integer
                          var iReturnVal = result.getInt(1);
                          //cleanup
                          result.close();
                          dbConn.close();
                          if (iReturnVal &gt; 0) {
                          // Stored proc returns +ive no. for success
                          logger.info(&apos;Processed add or update patient successfully.&apos;
                          }
                          else {
                          logger.info(&apos;Error: spHL7AddOrUpdatePatient failed.&apos;
                          }</script>
                          <type>JavaScript</type>
                          <data class="map">
                          <entry>
                          <string>Script</string>
                          <string>var tempAcct = &quot;NULL&quot;;
                          var tempPrefix = &quot;NULL&quot;;
                          var tempFirstName = &quot;NULL&quot;;
                          var tempLastName = &quot;NULL&quot;;
                          var tempMiddleName = &quot;NULL&quot;;
                          var tempSuffix = &quot;NULL&quot;;
                          var tempBirthDate = &quot;NULL&quot;;
                          var tempGender = &quot;NULL&quot;;
                          var tempAddress1 = &quot;NULL&quot;;
                          var tempAddress2 = &quot;NULL&quot;;
                          var tempCity = &quot;NULL&quot;;
                          var tempState = &quot;NULL&quot;;
                          var tempZipCode = &quot;NULL&quot;;
                          var tempPhone1 = &quot;NULL&quot;;
                          var tempPhone1Type = &quot;NULL&quot;;
                          var tempPhone2 = &quot;NULL&quot;;
                          var tempPhone2Type = &quot;NULL&quot;;
                          var tempDeathDate = &quot;NULL&quot;;
                          var tempModifiedSSN = &quot;NULL&quot;;

                          // External patient account number
                          if (msg[&apos;PID&apos;][&apos;PID.3&apos;][&apos;CX.1&apos;].toString() != null) {
                          tempAcct = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.3&apos;][&apos;CX.1&apos;].toString() + &quot;&apos;&quot;;
                          }
                          // Patient name prefix
                          if (msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.5&apos;].toString() != null) {
                          tempPrefix = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.5&apos;].toString() + &quot;&apos;&quot;;
                          }
                          // Patient first name
                          if (msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.2&apos;].toString() != null) {
                          tempFirstName = msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.2&apos;].toString().toString();
                          // Doubleup single quote for names link O&apos;Brian
                          tempFirstName = tempFirstName.replace(/&apos;/g, &quot;&apos;&apos;&quot;
                          // SQL Server stored proc expects varchar parameters to be passed within single quotes
                          tempFirstName = &quot;&apos;&quot; + tempFirstName + &quot;&apos;&quot;;
                          }
                          // Patient last name
                          if (msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.1&apos;].toString() != null) {
                          tempLastName = msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.1&apos;].toString().toString();
                          // Doubleup single quote for names link O&apos;Brian
                          tempLastName = tempLastName.replace(/&apos;/g, &quot;&apos;&apos;&quot;
                          // SQL Server stored proc expects varchar parameters to be passed within single quotes
                          tempLastName = &quot;&apos;&quot; + tempLastName + &quot;&apos;&quot;;
                          }
                          // Patient middle name
                          if (msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.3&apos;].toString() != null) {
                          tempMiddleName = msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.3&apos;].toString().toString();
                          // Doubleup single quote for names link O&apos;Brian
                          tempMiddleName = tempMiddleName.replace(/&apos;/g, &quot;&apos;&apos;&quot;
                          // SQL Server stored proc expects varchar parameters to be passed within single quotes
                          tempMiddleName = &quot;&apos;&quot; + tempMiddleName + &quot;&apos;&quot;;
                          }
                          // Patient name suffix
                          if (msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.4&apos;].toString() != null) {
                          tempSuffix = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.4&apos;].toString() + &quot;&apos;&quot;;
                          }
                          // Patient birth date
                          if (msg[&apos;PID&apos;][&apos;PID.7&apos;][&apos;TS.1&apos;].toString() != null) {
                          // Get birth date in mm/dd/yyyy format
                          var dob = msg[&apos;PID&apos;][&apos;PID.7&apos;][&apos;TS.1&apos;].toString();
                          var ar = dob.match(/(\d\d\d\d)(\d\d)(\d\d)/);
                          tempBirthDate = RegExp.$2 + &apos;/&apos; + RegExp.$3 + &apos;/&apos; + RegExp.$1;
                          tempBirthDate = &quot;&apos;&quot; + tempBirthDate + &quot;&apos;&quot;;
                          }
                          // Patient gender
                          if (msg[&apos;PID&apos;][&apos;PID.8&apos;].toString() != null) {
                          tempGender = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.8&apos;].toString() + &quot;&apos;&quot;;
                          }
                          // Patient address1
                          if (msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.1&apos;].toString() != null) {
                          tempAddress1 = msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.1&apos;].toString().toString();
                          // Doubleup single quote for address like St.Peter&apos;s Hospital Rd
                          tempAddress1 = tempAddress1.replace(/&apos;/g, &quot;&apos;&apos;&quot;
                          // SQL Server stored proc expects varchar parameters to be passed within single quotes
                          tempAddress1 = &quot;&apos;&quot; + tempAddress1 + &quot;&apos;&quot;;
                          }
                          // Patient address2
                          if (msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.2&apos;].toString() != null) {
                          tempAddress2 = msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.2&apos;].toString().toString();
                          // Doubleup single quote for address like St.Peter&apos;s Hospital Rd
                          tempAddress2 = tempAddress2.replace(/&apos;/g, &quot;&apos;&apos;&quot;
                          // SQL Server stored proc expects varchar parameters to be passed within single quotes
                          tempAddress2 = &quot;&apos;&quot; + tempAddress2 + &quot;&apos;&quot;;
                          }
                          // Patient city
                          if (msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.3&apos;].toString() != null) {
                          tempCity = msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.3&apos;].toString().toString();
                          // Doubleup single quote in case city name has a single quote
                          tempCity = tempCity.replace(/&apos;/g, &quot;&apos;&apos;&quot;
                          // SQL Server stored proc expects varchar parameters to be passed within single quotes
                          tempCity = &quot;&apos;&quot; + tempCity + &quot;&apos;&quot;;
                          }
                          // Patient state
                          if (msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.4&apos;].toString() != null) {
                          tempState = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.4&apos;].toString() + &quot;&apos;&quot;;
                          }

                          // Patient zipcode
                          if (msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.5&apos;].toString() != null) {
                          tempZipCode = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.5&apos;].toString() + &quot;&apos;&quot;;
                          }

                          // Get patient&apos;s phone1 w/o &quot;( )&quot; or &quot;-&quot;
                          var tempPhone1AreaCode = &quot;&quot;;
                          var tempPhone1Number = &quot;&quot;;
                          // Patient phone1 - area code
                          if (msg[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XAD.6&apos;].toString() != null) {
                          tempPhone1AreaCode = msg[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.6&apos;].toString();
                          }
                          // Patient phone1 - phone number
                          if (msg[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.7&apos;].toString() != null) {
                          tempPhone1Number = msg[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.7&apos;].toString();
                          }
                          if (tempPhone1AreaCode != &quot;&quot {
                          tempPhone1 = &quot;&apos;&quot; + tempPhone1AreaCode + tempPhone1Number + &quot;&apos;&quot;;
                          }
                          else {
                          tempPhone1 = &quot;&apos;&quot; + tempPhone1Number + &quot;&apos;&quot;;
                          }
                          // Patient phone1 type
                          if (msg[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.9&apos;].toString() != null) {
                          tempPhone1Type = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.9&apos;].toString() + &quot;&apos;&quot;;
                          }

                          // Get patient&apos;s phone2 w/o &quot;( )&quot; or &quot;-&quot;
                          var tempPhone2AreaCode = &quot;&quot;;
                          var tempPhone2Number = &quot;&quot;;
                          // Patient phone2 - area code
                          if (msg[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XAD.6&apos;].toString() != null) {
                          tempPhone2AreaCode = msg[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.6&apos;].toString();
                          }
                          // Patient phone2 - phone number
                          if (msg[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.7&apos;].toString() != null) {
                          tempPhone2Number = msg[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.7&apos;].toString();
                          }
                          if (tempPhone2AreaCode != &quot;&quot {
                          tempPhone2 = &quot;&apos;&quot; + tempPhone2AreaCode + tempPhone2Number + &quot;&apos;&quot;;
                          }
                          else {
                          tempPhone2 = &quot;&apos;&quot; + tempPhone2Number + &quot;&apos;&quot;;
                          }
                          // Patient phone2 type
                          if (msg[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.9&apos;].toString() != null) {
                          tempPhone2Type = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.9&apos;].toString() + &quot;&apos;&quot;;
                          }

                          // Get patient&apos;s death date in mm/dd/yyyy format
                          if (msg[&apos;PID&apos;][&apos;PID.29&apos;][&apos;TS.1&apos;].toString() != null) {
                          var deathDate = msg[&apos;PID&apos;][&apos;PID.29&apos;][&apos;TS.1&apos;].toString();
                          if (deathDate != null) {
                          var ar = deathDate.match(/(\d\d\d\d)(\d\d)(\d\d)/);
                          tempDeathDate = RegExp.$2 + &apos;/&apos; + RegExp.$3 + &apos;/&apos; + RegExp.$1;
                          tempDeathDate = &quot;&apos;&quot; + tempDeathDate + &quot;&apos;&quot;;
                          }
                          }

                          // Get patient SSN with &quot;-&quot; removed
                          if (msg[&apos;PID&apos;][&apos;PID.19&apos;].toString() != null) {
                          tempSSN = &quot;&apos;&quot; + msg[&apos;PID&apos;][&apos;PID.19&apos;].toString().toString() + &quot;&apos;&quot;;
                          tempModifiedSSN = tempSSN.replace(/-/g, &quot;&quot;
                          }

                          //DatabaseConnection
                          var dbConn = DatabaseConnectionFactory.createDatabaseConnection (globalMap.get(&apos;jdbcDriver&apos, globalMap.get(&apos;dbAddress&apos, globalMap.get(&apos;dbLogin&apos, globalMap.get(&apos;dbPassword&apos);

                          //Get parameters for the stored proc separated by ,
                          // Stored proc call will look like &quot;EXEC spHL7AddOrUpdatePatient &apos;1234&apos;, &apos;Mr&apos;, &apos;TestFN&apos;, ..., &apos;111223333&apos;&quot;;
                          var spParams = tempAcct + &apos;, &apos; + tempPrefix + &apos;, &apos; +
                          tempFirstName + &apos;, &apos; + tempMiddleName + &apos;, &apos; +
                          tempLastName + &apos;, &apos; + tempSuffix + &apos;, &apos; +
                          tempAddress1 + &apos;, &apos; + tempAddress2 + &apos;, &apos; +
                          tempCity + &apos;, &apos; + tempState + &apos;, &apos; +
                          tempZipCode + &apos;, &apos; + tempPhone1 + &apos;, &apos; +
                          tempPhone1Type + &apos;, &apos; + tempPhone2 + &apos;, &apos; +
                          tempPhone2Type + &apos;, &apos; + tempGender + &apos;, &apos; +
                          tempBirthDate + &apos;, &apos; + tempDeathDate + &apos;, &apos; +
                          tempModifiedSSN;

                          var expression = &quot;EXEC spHL7AddOrUpdatePatient &quot; + spParams;
                          // Print the SQL statement for debugging purpose
                          logger.info(&apos;SQL: &apos; + expression);
                          var result = dbConn.executeCachedQuery(expression);
                          //go to the first result
                          result.next();
                          //get the value from the first column as an integer
                          var iReturnVal = result.getInt(1);
                          //cleanup
                          result.close();
                          dbConn.close();
                          if (iReturnVal &gt; 0) {
                          // Stored proc returns +ive no. for success
                          logger.info(&apos;Processed add or update patient successfully.&apos;
                          }
                          else {
                          logger.info(&apos;Error: spHL7AddOrUpdatePatient failed.&apos;
                          }</string>
                          </entry>
                          </data>
                          </com.webreach.mirth.model.Step>
                          </steps>
                          <template>MSH|^~\&amp;|MIK04DEMO^MIK04DEMO^GUID||M irthHL7Test^MirthHL7Test^GUID||20060913190622||ADT ^A04|CAE0E035-8266-412b-BCDB-374836E3260C|P|2.3||||NE&#x0D;EVN|A04|200609131506 22||01&#x0D;PID|1|562001|562001||TestPatient^DevMP M04^T^Jr^Mr||19460130000000|F|||2368 Victory Ct^^Cincinnati^OH^45206||(937)555-6789CWork^Work^^^^937^5556789^^Work|(333)555-6789CCellular^Cellular^^^^333^5556789^^Cellular||U nknown or other|||111-22-3333||||||||||20050101000000|Y&#x0D;PV1|1|O|^^^13^ ^^^^Loma Linda Multispecialty Group||||2^Casey^Ben^G^MD^^^^&amp;3690&amp;UPIN&#x 0D;GT1|1|401|TestPatient^DevMPM04^T^Jr^Mr||2368 Victory Ct^^Cincinnati^OH^45206|(937)555-6789CWork^Work^^^^937^5556789^^Work|(333)555-6789CCellular^Cellular^^^^333^5556789^^Cellular|19 460130000000|F||Self|111-22-3333&#x0D;IN1|1|115|115|Blue Cross \T\Blue Shield^^^^^&amp;115|901 S Central Expy^PO Box 655730^Richardson^TX^75080||(972)766-6900^^^^^972^7666900||||||||Other|TestPatient^DevM PM04^T^Jr^Mr|Self|19460130000000|2368 Victory Ct^^Cincinnati^OH^45206||IN|1|||N|||||||||||111223 333|0||||||F||NV||||324&#x0D;IN2||111-22-3333||||||||||||||||||||||||||||0^0^365||||||||||| ||||||||||||||||||||111223333||(937)555-6789CWork^Work^^^^937^5556789^^Work~(333)555-6789CCellular^Cellular^^^^333^5556789^^Cellular</template>
                          </transformer>
                          <filter>
                          <rules>
                          <com.webreach.mirth.model.Rule>
                          <sequenceNumber>0</sequenceNumber>
                          <name>New Rule</name>
                          <script>// Filter for A01, A04, A08, A10, A28, A31 to handle add or update patient.
                          // Refer transformer step &quot;Call stored proc spHL7AddOrUpdatePatient&quot;

                          globalMap.put(&apos;jdbcDriver&apos;, &quot;net.sourceforge.jtds.jdbc.Driver&quot;
                          globalMap.put(&apos;dbAddress&apos;, &quot;jdbcostgresql://172.17.0.218:5432/mirth;&quot;
                          globalMap.put(&apos;dbLogin&apos;, &quot;postgres&quot;
                          globalMap.put(&apos;dbPassword&apos;, &quot;medic123&quot;
                          &#x0D;
                          if (msg[&apos;MSH&apos;][&apos;MSH.9&apos;][&apos;CM_MSG.2&apos;] == &apos;A01&apos; ||
                          msg[&apos;MSH&apos;][&apos;MSH.9&apos;][&apos;CM_MSG.2&apos;] == &apos;A04&apos; ||
                          msg[&apos;MSH&apos;][&apos;MSH.9&apos;][&apos;CM_MSG.2&apos;] == &apos;A08&apos; ||
                          msg[&apos;MSH&apos;][&apos;MSH.9&apos;][&apos;CM_MSG.2&apos;] == &apos;A10&apos; ||
                          msg[&apos;MSH&apos;][&apos;MSH.9&apos;][&apos;CM_MSG.2&apos;] == &apos;A28&apos; ||
                          msg[&apos;MSH&apos;][&apos;MSH.9&apos;][&apos;CM_MSG.2&apos;] == &apos;A31&apos{
                          return true;
                          }
                          else {
                          logger.info(&apos;Not an A01, A04, A08, A10, A28, or A31 message - Msg. ignored&apos;
                          return false;
                          }</script>
                          <operator>NONE</operator>
                          </com.webreach.mirth.model.Rule>
                          </rules>
                          <template>MSH|^~\&amp;|MIK04DEMO^MIK04DEMO^GUID||M irthHL7Test^MirthHL7Test^GUID||20060913190622||ADT ^A04|CAE0E035-8266-412b-BCDB-374836E3260C|P|2.3||||NE&#x0D;EVN|A04|200609131506 22||01&#x0D;PID|1|562001|562001||TestPatient^DevMP M04^T^Jr^Mr||19460130000000|F|||2368 Victory Ct^^Cincinnati^OH^45206||(937)555-6789CWork^Work^^^^937^5556789^^Work|(333)555-6789CCellular^Cellular^^^^333^5556789^^Cellular||U nknown or other|||111-22-3333||||||||||20050101000000|Y&#x0D;PV1|1|O|^^^13^ ^^^^Loma Linda Multispecialty Group||||2^Casey^Ben^G^MD^^^^&amp;3690&amp;UPIN&#x 0D;GT1|1|401|TestPatient^DevMPM04^T^Jr^Mr||2368 Victory Ct^^Cincinnati^OH^45206|(937)555-6789CWork^Work^^^^937^5556789^^Work|(333)555-6789CCellular^Cellular^^^^333^5556789^^Cellular|19 460130000000|F||Self|111-22-3333&#x0D;IN1|1|115|115|Blue Cross \T\Blue Shield^^^^^&amp;115|901 S Central Expy^PO Box 655730^Richardson^TX^75080||(972)766-6900^^^^^972^7666900||||||||Other|TestPatient^DevM PM04^T^Jr^Mr|Self|19460130000000|2368 Victory Ct^^Cincinnati^OH^45206||IN|1|||N|||||||||||111223 333|0||||||F||NV||||324&#x0D;IN2||111-22-3333||||||||||||||||||||||||||||0^0^365||||||||||| ||||||||||||||||||||111223333||(937)555-6789CWork^Work^^^^937^5556789^^Work~(333)555-6789CCellular^Cellular^^^^333^5556789^^Cellular</template>
                          </filter>
                          <transportName>Database Writer</transportName>
                          </com.webreach.mirth.model.Connector>
                          </destinationConnectors>
                          <properties>
                          <property name="initialState">started</property>
                          <property name="synchronous">false</property>
                          <property name="store_messages">false</property>
                          <property name="recv_xml_encoded">false</property>
                          <property name="encryptData">false</property>
                          <property name="transactional">false</property>
                          <property name="max_message_age">-1</property>
                          <property name="error_messages_only">false</property>
                          </properties>
                          <preprocessingScript>// Modify the message variable below to pre process data&#x0D;
                          return message;</preprocessingScript>
                          </com.webreach.mirth.model.Channel>

                          Comment


                          • #14
                            Re: tables of database

                            It worked when I tried this channel.

                            I tested it on Mirth 1.3.1 (Yours is 1.3.2 but that should not matter).

                            I imported this channel, changed the Listener IP Address to 127.0.0.1 and the database connection string to SQL Server 2000 (I don&#039;t have postgre sql) and sent a test message. Mirth received it and updated the database.

                            Comment


                            • #15
                              Re: tables of database

                              but I have in my computer a database postgres, i change the ip but the same thing continues happening to me.
                              t that I do evil but I have a datebase postgres and cannot insert the message with the channel of the example and the message of the ejemplo.can you help me?

                              Comment

                              Working...
                              X