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

HLTP01.m

Go to the documentation of this file.
  1. HLTP01 ;AISC/SAW-Transaction Processor Module (Cont'd) ;02/16/2000 11:15
  1. ;;1.6;HEALTH LEVEL SEVEN;**2,25,34,47,60**;Oct 13, 1995
  1. ;
  1. ;Validate message header
  1. D CHK^HLTPCK1(HLHDR,.HL,$S($G(HLMSA)'="":$P(HLMSA,$E(HLHDR,4),2,4),1:""))
  1. ;
  1. ;Change stored message ID to match that of the incoming message
  1. S HL("TMP")=$$CHNGMID^HLTF(HLMTIEN,HL("MID"))
  1. ;
  1. ;Remember new message ID if it was changed
  1. I ('HL("TMP")) S HLMID=HL("MID")
  1. ;
  1. ;Update zero node in Message Text file of incoming message
  1. D UPDATE^HLTF0(HLMTIEN,$S($D(HL("MTIENS")):HL("MTIENS"),1:HLMTIEN),"I",$G(HL("EID")),"",$G(HL("SAP")),"I")
  1. ;
  1. ;Update status of incoming message
  1. D STATUS^HLTF0(HLMTIEN,$S($G(HL):4,1:9),$S($G(HL):+HL,1:""),$S($G(HL):$P(HL,"^",2),1:""))
  1. ;
  1. ;Update Logical Link file statistics for message received through MailMan
  1. ;The protocols associated with dynamically addressed messages
  1. ;should not have a logical link defined.
  1. ;This results in the monitor not being updated correctly and
  1. ;acks cannot be addressed properly.
  1. ;Get sender from mailman variable XMFROM and try to resolve link from
  1. ;domain info (pointer in 870).
  1. I HLLD0="XM",$G(XMFROM)]"" D
  1. .N HLDOM,HLLINK,HLROUT
  1. .S HLDOM=$P(XMFROM,"@",2)
  1. .I $G(HL("EIDS"))]"" S HL("LL")=$P(^ORD(101,HL("EIDS"),770),U,7),HLROUT=$G(^ORD(101,HL("EIDS"),774))
  1. .Q:$G(HLROUT)=""
  1. .D LINK^HLUTIL3(HLDOM,.HLLINK,"D")
  1. .I $O(HLLINK(0)) S HL("LL")=$O(HLLINK(0))
  1. .;If Ack is required, dynamically address it to sender:
  1. .;Note-first piece (recipient) not required here
  1. .I $O(HLLINK(0)) S $P(HLL("LINKS",1),U,2)=HL("LL")
  1. I HLLD0="XM",$G(HL("LL"))]"" D
  1. . S X=$$ENQUEUE^HLCSQUE(HL("LL"),"IN")
  1. . D MONITOR^HLCSDR2("P",2,HL("LL"),$P(X,U,2),"IN")
  1. ;
  1. ;Quit if this is acknowledgment to acknowledgement message
  1. I $G(HL("ACK")) D G EXIT
  1. .;Update status of original acknowledgment message to successfully
  1. .; completed if no error occurred
  1. .I '$G(HL) D STATUS^HLTF0(HL("MTIENS"),3)
  1. ;
  1. ;Create message ID and Message Text IEN for subscriber entry in Message
  1. ; Text file - carry over message ID of original message
  1. S HLMIDS=HLMID
  1. D CREATE^HLTF(.HLMIDS,.HLMTIENS,.HLDTS,.HLDT1S)
  1. K HLDTS,HLDT1S,HLMIDS
  1. ;
  1. ;Update zero node in Message Text file of subscriber entry
  1. D UPDATE^HLTF0(HLMTIENS,HLMTIEN,"I",$G(HL("EIDS")),$G(HL("RAP")),"","I")
  1. ;
  1. ;Create and send COMMIT acknowledgment if required
  1. I $G(HLMSA)="",$G(HL("RAP"))&$G(HL("SAP")) D
  1. .I '$D(HL("ACAT")),'$D(HL("APAT")),'HL Q
  1. .I $G(HL("ACAT"))="NE" Q
  1. .I $G(HL("ACAT"))="ER",'HL Q
  1. .I $G(HL("ACAT"))="SU",HL Q
  1. .;Version 2.1 messages always ORIGINAL MODE-application must generate
  1. .;ack. if error in hdr, hl7 rejects-quits.
  1. .S HLA("HLA",1)="MSA"_HL("FS")_$S(HL:$S(HL("VER")=2.1:"AR",1:"CR"),1:"CA")_HL("FS")_HL("MID")_HL("FS")_$P(HL,"^",2)
  1. .;I $D(HLA("HLA")) S HLP("MSACK")=1 D GENACK^HLMA1(HL("EID"),HLMTIENS,HL("EIDS"),"LM",1,.HLRESLT,"",.HLP)
  1. .S HLP("MSACK")=1
  1. .;added next line to save off HL* variables due to recursive call;sfciofo/ac
  1. .N HLSAVE M HLSAVE=HL
  1. .D GENACK^HLMA1(HL("EID"),HLMTIENS,HL("EIDS"),"LM",1,.HLRESLT,"",.HLP)
  1. .I $D(HLSAVE) M HL=HLSAVE
  1. ;
  1. ;Quit processing if error with header
  1. ;Potential problem with patch 25 that may affect internal DHCP to DHCP
  1. ;messaging. As a test, replaced next line with following line to correct:
  1. ;I HL'="" S HLRESLT=HL G EXIT
  1. I $G(HL)]"" S HLRESLT=HL G EXIT
  1. ;Comment out next line. Potential problem with patch 34 affecting
  1. ;dhcp to dhcp messaging:
  1. ;I HL("TMP")'=0 S HLRESLT="13^"_$P(HL("TMP"),"^",2)
  1. I $G(HL("TMP")) S HLRESLT="13^"_$P(HL("TMP"),"^",2)
  1. ;
  1. ;Set special HL variables
  1. S HLQUIT=0,HLNODE="",HLNEXT="D HLNEXT^HLCSUTL"
  1. ;
  1. ;Check if message is an acknowledgement
  1. I ($G(HLMSA)'="") D G EXIT
  1. .;Update status of original subscriber message
  1. .D STATUS^HLTF0(HL("MTIENS"),$S("AA,CA"[$P(HLMSA,HL("FS"),2):3,1:4),"",$S("AA,CA"[$P(HLMSA,HL("FS"),2):"",1:$P(HLMSA,HL("FS"),3)))
  1. .D PROCACK^HLTP2(HLMTIEN,HL("EID"),.HLRESLT,.HL)
  1. ;
  1. ;Get entry action, exit action and processing routine
  1. K HLHDR,HLLD0,HLLD1,HLMSA
  1. I $G(HL("EIDS"))="",$G(HLEIDS)]"" S HL("EIDS")=HLEIDS ;**CIRN**
  1. D EVENT^HLUTIL1(HL("EIDS"),"15,20,771",.HLN)
  1. S HLENROU=$G(HLN(20)),HLEXROU=$G(HLN(15))
  1. S HLPROU=$G(HLN(771)) I HLPROU']"" S HLRESLT="10^"_$G(^HL(771.7,10,0)) G EXIT
  1. ;
  1. ;Execute entry action of client protocol
  1. X:HLENROU]"" HLENROU K HLENROU
  1. ;
  1. ;Execute processing routine
  1. X HLPROU S HLRESLT=0 S:($D(HLERR)) HLRESLT="9^"_$G(^HL(771.7,9,0))
  1. EXIT K HL,HLHDR,HLMSA
  1. Q