Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PRCHJS04

PRCHJS04.m

Go to the documentation of this file.
  1. PRCHJS04 ;OI&T/KCL - IFCAP/ECMS INTERFACE 2237 MSG BUILD SEND;7/2/12
  1. ;;5.1;IFCAP;**167**;Oct 20, 2000;Build 17
  1. ;Per VHA Directive 2004-38, this routine should not be modified.
  1. ;
  1. OMNO07(PRCWRK,PRCER) ;Build/Send HL7 OMN^O07 message
  1. ;This function builds a single HL7 OMN^O07 message containing a
  1. ;2237 transaction and queues it for transmission to eCMS using HLO APIs.
  1. ;
  1. ; Supported ICR:
  1. ; #5818 - Obtain the TCP/IP PORT (OPTIMIZED) field for a record
  1. ; in the HL LOGICAL LINK (#870) file using $$PORT2^HLOTLNK.
  1. ;
  1. ; Input:
  1. ; PRCWRK - (required) name of work global containing 2237 data elements
  1. ;
  1. ; Output:
  1. ; Function value - on success, returns IEN of the message in the HLO
  1. ; MESSAGES (#778) file. Returns 0 on failure.
  1. ; PRCER - (optional) on failure, an error message is returned,
  1. ; pass by ref
  1. ;
  1. N PRCPARMS ;HLO input parameters
  1. N PRCWHOTO ;HLO send to parameters
  1. N PRCMSG ;HLO workspace used to build message
  1. N PRCIDX ;line items subscript
  1. N PRCRSLT ;function result
  1. ;
  1. S PRCRSLT=0
  1. ;
  1. ;start building a single HL7 msg
  1. S PRCPARMS("MESSAGE TYPE")="OMN"
  1. S PRCPARMS("EVENT")="O07"
  1. S PRCPARMS("FIELD SEPARATOR")="|"
  1. S PRCPARMS("ENCODING CHARACTERS")="^~\&"
  1. S PRCPARMS("MESSAGE STRUCTURE")="OMN_O07"
  1. S PRCPARMS("VERSION")=2.5
  1. S PRCPARMS("ACCEPT ACK TYPE")="AL" ;commit ACKs are required to be returned
  1. S PRCPARMS("APP ACK TYPE")="AL" ;application ACKs are required to be returned
  1. S PRCPARMS("SENDING APPLICATION")="PRCHJ_IFCAP_2237_SEND"
  1. I '$$NEWMSG^HLOAPI(.PRCPARMS,.PRCMSG,.PRCER) Q PRCRSLT
  1. ;
  1. ;build NTE segs for 2237 Special Remarks, Justification, and Comments
  1. I '$$NTE^PRCHJS06(PRCWRK,.PRCMSG,.PRCER) Q PRCRSLT
  1. ;
  1. ;loop thru 2237 line items and build the optional Order Group segs:
  1. ; {(ORDER)ORC,{[TQ1]}RQD,RQ1,[ZA1],{NTE}}
  1. S PRCIDX=0
  1. F S PRCIDX=$O(@PRCWRK@(PRCIDX)) Q:'(+$G(PRCIDX))!($G(PRCER)]"") D
  1. . ;
  1. . ;build ORC seg
  1. . I '$$ORC^PRCHJS05(PRCWRK,.PRCMSG,.PRCER) Q
  1. . ;
  1. . ;if delivery schedule(s) for item, build TQ1 seg(s)
  1. . I $O(@PRCWRK@(PRCIDX,0)) D
  1. . . I '$$TQ1^PRCHJS05(PRCWRK,.PRCMSG,PRCIDX,.PRCER) Q
  1. . Q:$G(PRCER)]""
  1. . ;
  1. . ;build RQD seg
  1. . I '$$RQD^PRCHJS05(PRCWRK,.PRCMSG,PRCIDX,.PRCER) Q
  1. . ;
  1. . ;build RQ1 seg
  1. . I '$$RQ1^PRCHJS05(PRCWRK,.PRCMSG,PRCIDX,.PRCER) Q
  1. . ;
  1. . ;build ZA1 seg
  1. . I '$$ZA1^PRCHJS05(PRCWRK,.PRCMSG,PRCIDX,.PRCER) Q
  1. . ;
  1. . ;build NTE seg(s)
  1. . I '$$NTEITEM^PRCHJS05(PRCWRK,.PRCMSG,PRCIDX,.PRCER) Q
  1. ;
  1. ;quit if error encountered building Order Group segs
  1. Q:$G(PRCER)]"" PRCRSLT
  1. ;
  1. ;build ZZ1 seg
  1. I '$$ZZ1^PRCHJS06(PRCWRK,.PRCMSG,.PRCER) Q PRCRSLT
  1. ;
  1. ;build ZZ2 seg
  1. I '$$ZZ2^PRCHJS06(PRCWRK,.PRCMSG,.PRCER) Q PRCRSLT
  1. ;
  1. ;build ZZ3 seg
  1. I '$$ZZ3^PRCHJS06(PRCWRK,.PRCMSG,.PRCER) Q PRCRSLT
  1. ;
  1. ;send a single HL7 msg
  1. S PRCWHOTO("RECEIVING APPLICATION")="PRCHJ_ECMS_2237_SEND"
  1. S PRCWHOTO("STATION NUMBER")=200 ;allow VIE box to route msg to Austin (eCMS)
  1. ;set these 2 params to allow HLO to send msg to VIE box
  1. S PRCWHOTO("MIDDLEWARE LINK NAME")="PRCHJ_ECMS" ;name of logical link for the interface engine
  1. S PRCWHOTO("PORT")=$$PORT2^HLOTLNK("PRCHJ_ECMS") ;get port from logical link record
  1. I PRCWHOTO("PORT")']"" S PRCER="Unable to obtain HLO port from logical link record" Q PRCRSLT
  1. S PRCRSLT=$$SENDONE^HLOAPI1(.PRCMSG,.PRCPARMS,.PRCWHOTO,.PRCER) ;returns msg ien, 0 on failure
  1. ;
  1. Q PRCRSLT