Ignore:
Timestamp:
Dec 4, 2009, 12:11:15 AM (14 years ago)
Author:
George Lilly
Message:

revised back to 6/30/08 version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WorldVistAEHR/trunk/r/MY_HEALTHEVET-MHV/MHV7T.m

    r613 r623  
    1 MHV7T   ;WAS/GPM - HL7 TRANSMITTER ; 10/25/05 4:10pm [12/24/07 9:45pm]
    2         ;;1.0;My HealtheVet;**2**;Aug 23, 2005;Build 22
    3         ;;Per VHA Directive 2004-038, this routine should not be modified.
    4         ;
    5         Q
    6         ;
    7 XMIT(REQ,XMT,ERR,DATAROOT,HL)   ;Build and Transmit HL7 message
    8         ;   Builds and sends the desired HL7 message based on the mode and
    9         ; builder passed in XMT.  If the builder requires other information
    10         ; to build the message, it can be passed as additional subscripts of
    11         ; XMT or REQ.  REQ is used for request or query related parameters,
    12         ; XMT for transmission and control related parameters.
    13         ;
    14         ;  The message builder sent in XMT("BUILDER") is called to build the
    15         ; desired message.
    16         ;
    17         ;  A synchronous response is indicated by XMT("MODE") of S, and sent
    18         ; on the current interface as an original mode acknowledgement.
    19         ;
    20         ;  An asynchronous response is indicated by XMT("MODE") of A, and
    21         ; sent on the interface associated with XMT("PROTOCOL") as an
    22         ; enhanced mode application acknowledgement.  Large messages can be
    23         ; sent as a bolus (series of messages without batch formatting) by
    24         ; specifying an XMT("MAX SIZE").
    25         ;
    26         ;  A message may be initiated by using the asynchronous mode settings
    27         ;  Synchronous messages cannot be initiated with this API.
    28         ;
    29         ;  Integration Agreements:
    30         ;         2161 : INIT^HLFNC2
    31         ;         2164 : GENERATE^HLMA
    32         ;         2165 : GENACK^HLMA1
    33         ;
    34         ;  Input:
    35         ;         REQ - Request parameters and Message ID of original message
    36         ;         XMT - Transmission parameters
    37         ;            XMT("MODE") - Mode of the transmission
    38         ;            XMT("PROTOCOL") - Protocol for deferred transmissions
    39         ;            XMT("BUILDER") - Name/tag of message builder routine
    40         ;            XMT("HLMTIENS") - Original message IEN - Immediate mode
    41         ;            XMT("MAX SIZE") - Maximum message size (asynch only)
    42         ;         ERR - Caret delimited error string
    43         ;               segment^sequence^field^code^ACK type^error text
    44         ;    DATAROOT - Global root of data array
    45         ;          HL - HL7 package array variable
    46         ;
    47         ;  Output: HL7 Message Transmitted
    48         ;
    49         N MSGROOT,HLRSLT,HLP,MSGLEN
    50         D LOG^MHVUL2("TRANSMIT","BEGIN","S","TRACE")
    51         I XMT("MODE")="A" D           ;Asynchronous mode
    52         . D LOG^MHVUL2("TRANSMIT","ASYNCHRONOUS","S","TRACE")
    53         . K HL
    54         . D INIT^HLFNC2(XMT("PROTOCOL"),.HL)
    55         . I $G(HL) S ERR=HL D LOG^MHVUL2("PROTOCOL INIT FAILURE",ERR,"S","ERROR") Q
    56         . D LOG^MHVUL2("PROTOCOL INIT","DONE "_XMT("MODE"),"S","DEBUG")
    57         . S MSGROOT="^TMP(""HLS"",$J)"
    58         . D @(XMT("BUILDER")_"(MSGROOT,.REQ,ERR,DATAROOT,.MSGLEN,.HL)")
    59         . D LOG^MHVUL2("BUILD "_$P(XMT("BUILDER"),"^"),MSGROOT,"I","DEBUG")
    60         . I MSGLEN<XMT("MAX SIZE")!'XMT("MAX SIZE") D  Q
    61         . . D GENERATE^HLMA(XMT("PROTOCOL"),"GM",1,.HLRSLT,"",.HLP)
    62         . . K @MSGROOT
    63         . . D LOG^MHVUL2("TRANSMIT "_$P(XMT("BUILDER"),"^"),.HLRSLT,"M","DEBUG")
    64         . . Q
    65         . D BOLUS^MHV7TB(MSGROOT,.XMT,.HL)
    66         . Q
    67         ;
    68         I XMT("MODE")="S" D           ;Synchronous mode
    69         . D LOG^MHVUL2("TRANSMIT","SYNCHRONOUS","S",0)
    70         . S MSGROOT="^TMP(""HLA"",$J)"
    71         . D @(XMT("BUILDER")_"(MSGROOT,.REQ,ERR,DATAROOT,.MSGLEN,.HL)")
    72         . D LOG^MHVUL2("BUILD "_$P(XMT("BUILDER"),"^"),MSGROOT,"I","DEBUG")
    73         . D GENACK^HLMA1(HL("EID"),XMT("HLMTIENS"),HL("EIDS"),"GM",1,.HLRSLT)
    74         . K @MSGROOT
    75         . D LOG^MHVUL2("TRANSMIT "_$P(XMT("BUILDER"),"^"),.HLRSLT,"M","DEBUG")
    76         . Q
    77         D LOG^MHVUL2("TRANSMIT","END","S","TRACE")
    78         Q
    79         ;
    80 EMAIL(REQ,XMT,ERR,DATAROOT,HL)  ;Build and Transmit HL7 message
    81         ;   Builds and sends the desired HL7 message via email.
    82         ; This will only be used until the MHV server can establish normal
    83         ; HL7 receivers.
    84         ;
    85         ;  If the builder requires other information to build the message, it
    86         ; can be passed as additional subscripts of XMT or REQ.  REQ is used
    87         ; for request or query related parameters, XMT for transmission and
    88         ; control related parameters.
    89         ;
    90         ;  The message builder sent in XMT("BUILDER") is called to build the
    91         ; desired message.
    92         ;
    93         ;  Integration Agreements:
    94         ;         2161 : INIT^HLFNC2
    95         ;                 MSH^HLFNC2
    96         ;        10070 : ^XMD
    97         ;
    98         ;  Input:
    99         ;         REQ - Request parameters and Message ID of original message
    100         ;         XMT - Transmission parameters
    101         ;            XMT("PROTOCOL") - Protocol for deferred transmissions
    102         ;            XMT("BUILDER") - Name/tag of message builder routine
    103         ;            XMT("SAF") - Sending Facility
    104         ;            XMT("EMAIL") - Email Address to use
    105         ;         ERR - Caret delimited error string
    106         ;               segment^sequence^field^code^ACK type^error text
    107         ;    DATAROOT - Global root of data array
    108         ;          HL - HL7 package array variable
    109         ;
    110         ;  Output: HL7 Message Transmitted
    111         ;
    112         N MSGROOT,MID,MSH,CNT,MSGLEN
    113         N TEXT,XMDUN,XMDUZ,XMTEXT,XMROU,XMSTRIP,XMSUB,XMY,XMZ,XMDF,XMMG
    114         D LOG^MHVUL2("TRANSMIT","EMAIL","S","TRACE")
    115         K HL
    116         D INIT^HLFNC2(XMT("PROTOCOL"),.HL)
    117         I $G(HL) S ERR=HL D LOG^MHVUL2("PROTOCOL INIT FAIL",ERR,"S","ERROR") Q
    118         D LOG^MHVUL2("PROTOCOL INIT","DONE EMAIL","S","DEBUG")
    119         S MSGROOT="^TMP(""MHV7TEM"",$J)"
    120         D @(XMT("BUILDER")_"(MSGROOT,.REQ,ERR,DATAROOT,.MSGLEN,.HL)")
    121         D LOG^MHVUL2("BUILD "_$P(XMT("BUILDER"),"^"),MSGROOT,"I","DEBUG")
    122         S MID=+$H_"-"_$P($H,",",2)
    123         S HL("SAF")=XMT("SAF")
    124         D MSH^HLFNC2(.HL,MID,.MSH)
    125         S XMDF="",(XMDUN,XMDUZ)="My HealtheVet Package"
    126         S XMY(XMT("EMAIL"))=""
    127         S XMSUB=XMT("SAF")_" MHV PACKAGE MESSAGE"
    128         S XMTEXT="TEXT("
    129         S TEXT(1)=MSH
    130         F CNT=1:1 Q:'$D(@MSGROOT@(CNT))  S TEXT(CNT+1)=@MSGROOT@(CNT)
    131         D ^XMD
    132         K @MSGROOT
    133         I $D(XMMG) D LOG^MHVUL2("EMAIL TRANSMIT","FAILURE: "_XMMG,"S","ERROR") Q
    134         D LOG^MHVUL2("EMAIL TRANSMIT","SUCCESS: "_XMZ,"S","TRACE")
    135         Q
     1MHV7T ;WAS/GPM - HL7 TRANSMITTER ; [8/22/05 11:54pm]
     2 ;;1.0;My HealtheVet;;Aug 23, 2005
     3 ;;Per VHA Directive 2004-038, this routine should not be modified.
     4 ;
     5 Q
     6 ;
     7XMIT(REQ,XMT,ERR,DATAROOT,HL) ;Build and Transmit HL7 message
     8 ;   Builds and sends the desired HL7 message based on the mode and
     9 ; builder passed in XMT.  If the builder requires other information
     10 ; to build the message, it can be passed as additional subscripts of
     11 ; XMT or REQ.  REQ is used for request or query related parameters,
     12 ; XMT for transmission and control related parameters.
     13 ;
     14 ;  The message builder sent in XMT("BUILDER") is called to build the
     15 ; desired message.
     16 ;
     17 ;  An immediate mode response is indicated by XMT("MODE") of I, and
     18 ; sent on the current interface as an original mode acknowledgement.
     19 ;
     20 ;  A deferred mode response is indicated by XMT("MODE") of D, and
     21 ; sent on the interface associated with XMT("PROTOCOL") as an
     22 ; enhanced mode application acknowledgement.
     23 ;
     24 ;  A message may be initiated by using the deferred mode settings.
     25 ;  Synchronous messages cannot be initiate with this API.
     26 ;
     27 ;  Integration Agreements:
     28 ;         2161 : INIT^HLFNC2
     29 ;         2164 : GENERATE^HLMA
     30 ;         2165 : GENACK^HLMA1
     31 ;
     32 ;  Input:
     33 ;         REQ - Request parameters and Message ID of original message
     34 ;         XMT - Transmission parameters
     35 ;            XMT("MODE") - Priority or mode of the transmission
     36 ;            XMT("PROTOCOL") - Protocol for deferred transmissions
     37 ;            XMT("BUILDER") - Name/tag of message builder routine
     38 ;            XMT("HLMTIENS") - Original message IEN - Immediate mode
     39 ;         ERR - Caret delimited error string
     40 ;               segment^sequence^field^code^ACK type^error text
     41 ;    DATAROOT - Global root of data array
     42 ;          HL - HL7 package array variable
     43 ;
     44 ;  Output: HL7 Message Transmitted
     45 ;
     46 N MSGROOT,HLRSLT,HLP
     47 I XMT("MODE")="D" D           ;Deferred mode
     48 . D LOG^MHV7U("TRANSMIT","DEFERRED MODE","S",0)
     49 . K HL
     50 . D INIT^HLFNC2(XMT("PROTOCOL"),.HL)
     51 . I $G(HL) S ERR=HL D LOG^MHV7U("PROTOCOL INIT FAIL",ERR,"S",0) Q
     52 . D LOG^MHV7U("PROTOCOL INIT","DONE "_XMT("MODE"),"S",0)
     53 . S MSGROOT="^TMP(""HLS"",$J)"
     54 . D @(XMT("BUILDER")_"(MSGROOT,.REQ,ERR,DATAROOT,.HL)")
     55 . D LOG^MHV7U("BUILD "_$P(XMT("BUILDER"),"^"),MSGROOT,"I",0)
     56 . D GENERATE^HLMA(XMT("PROTOCOL"),"GM",1,.HLRSLT,"",.HLP)
     57 . K @MSGROOT
     58 . D LOG^MHV7U("TRANSMIT "_$P(XMT("BUILDER"),"^"),.HLRSLT,"M",0)
     59 . Q
     60 ;
     61 I XMT("MODE")="I" D           ;Immediate mode
     62 . D LOG^MHV7U("TRANSMIT","IMMEDIATE MODE","S",0)
     63 . S MSGROOT="^TMP(""HLA"",$J)"
     64 . D @(XMT("BUILDER")_"(MSGROOT,.REQ,ERR,DATAROOT,.HL)")
     65 . D LOG^MHV7U("BUILD "_$P(XMT("BUILDER"),"^"),MSGROOT,"I",0)
     66 . D GENACK^HLMA1(HL("EID"),XMT("HLMTIENS"),HL("EIDS"),"GM",1,.HLRSLT)
     67 . K @MSGROOT
     68 . D LOG^MHV7U("TRANSMIT "_$P(XMT("BUILDER"),"^"),.HLRSLT,"M",0)
     69 . Q
     70 D LOG^MHV7U("TRANSMIT","COMPLETE","S",0)
     71 Q
     72 ;
     73EMAIL(REQ,XMT,ERR,DATAROOT,HL) ;Build and Transmit HL7 message
     74 ;   Builds and sends the desired HL7 message via email.
     75 ; This will only be used until the MHV server can establish normal
     76 ; HL7 receivers.
     77 ;
     78 ;  If the builder requires other information to build the message, it
     79 ; can be passed as additional subscripts of XMT or REQ.  REQ is used
     80 ; for request or query related parameters, XMT for transmission and
     81 ; control related parameters.
     82 ;
     83 ;  The message builder sent in XMT("BUILDER") is called to build the
     84 ; desired message.
     85 ;
     86 ;  Integration Agreements:
     87 ;         2161 : INIT^HLFNC2, MSH^HLFNC2
     88 ;        10070 : ^XMD
     89 ;
     90 ;  Input:
     91 ;         REQ - Request parameters and Message ID of original message
     92 ;         XMT - Transmission parameters
     93 ;            XMT("PROTOCOL") - Protocol for deferred transmissions
     94 ;            XMT("BUILDER") - Name/tag of message builder routine
     95 ;            XMT("SAF") - Sending Facility
     96 ;            XMT("EMAIL") - Email Address to use
     97 ;         ERR - Caret delimited error string
     98 ;               segment^sequence^field^code^ACK type^error text
     99 ;    DATAROOT - Global root of data array
     100 ;          HL - HL7 package array variable
     101 ;
     102 ;  Output: HL7 Message Transmitted
     103 ;
     104 N MSGROOT,MID,MSH,CNT
     105 N TEXT,XMDUN,XMDUZ,XMTEXT,XMROU,XMSTRIP,XMSUB,XMY,XMZ,XMDF,XMMG
     106 D LOG^MHV7U("TRANSMIT","EMAIL","S",0)
     107 K HL
     108 D INIT^HLFNC2(XMT("PROTOCOL"),.HL)
     109 I $G(HL) S ERR=HL D LOG^MHV7U("PROTOCOL INIT FAIL",ERR,"S",0) Q
     110 D LOG^MHV7U("PROTOCOL INIT","DONE EMAIL","S",0)
     111 S MSGROOT="^TMP(""MHV7TEM"",$J)"
     112 D @(XMT("BUILDER")_"(MSGROOT,.REQ,ERR,DATAROOT,.HL)")
     113 D LOG^MHV7U("BUILD "_$P(XMT("BUILDER"),"^"),MSGROOT,"I",0)
     114 S MID=+$H_"-"_$P($H,",",2)
     115 S HL("SAF")=XMT("SAF")
     116 D MSH^HLFNC2(.HL,MID,.MSH)
     117 S XMDF="",(XMDUN,XMDUZ)="My HealtheVet Package"
     118 S XMY(XMT("EMAIL"))=""
     119 S XMSUB=XMT("SAF")_" MHV PACKAGE MESSAGE"
     120 S XMTEXT="TEXT("
     121 S TEXT(1)=MSH
     122 F CNT=1:1 Q:'$D(@MSGROOT@(CNT))  S TEXT(CNT+1)=@MSGROOT@(CNT)
     123 D ^XMD
     124 K @MSGROOT
     125 I $D(XMMG) D LOG^MHV7U("EMAIL TRANSMIT","FAILURE: "_XMMG,"S",0) Q
     126 D LOG^MHV7U("EMAIL TRANSMIT","SUCCESS: "_XMZ,"S",0)
     127 Q
Note: See TracChangeset for help on using the changeset viewer.