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

HLUTIL3.m

Go to the documentation of this file.
  1. HLUTIL3 ;ALB/MTC - VARIOUS HL7 UTILITIES ;11/19/2003 15:37
  1. ;;1.6;HEALTH LEVEL SEVEN;**2,41,109**;Oct 13, 1995
  1. ;
  1. Q
  1. ;
  1. FNDSTAT(IEN) ;- This function will return the appropriate status based
  1. ; on the Accept Ack, Application Ack and version of the protocol
  1. ; being utilized.
  1. ;
  1. ; INPUT : IEN of the HL7 Message File (#772)
  1. ; OUTPUT: Pointer to HL7 Message Status File (#771.6) OR NULL if
  1. ; Not valid IEN or No parent.
  1. ;
  1. N PROTOCOL,PARENTP,PARENT,PROT
  1. N CHILD,RESULT
  1. N HLCA,HLAA
  1. ;
  1. S RESULT=""
  1. G:'IEN EXIT
  1. ;-- Find Parent
  1. S CHILD=$G(^HL(772,IEN,0))
  1. I CHILD="" G EXIT
  1. S PARENTP=$P(CHILD,"^",8)
  1. I (PARENTP="") G EXIT
  1. S PARENT=$G(^HL(772,PARENTP,0))
  1. ;
  1. S PROT=$P(PARENT,"^",10)
  1. S PROTOCOL=$$TYPE^HLUTIL2(PROT)
  1. S HLCA=$P(PROTOCOL,U,7)
  1. S HLAA=$P(PROTOCOL,U,8)
  1. ;
  1. ;-- if this is a responce (ack) message set to "sucessful"
  1. I $P(PARENT,U,7) S RESULT=3 G EXIT
  1. ;-- HLCA and HLAA assume original ack rules set to "awaiting ack"
  1. I HLCA="",HLAA="" S RESULT=2 G EXIT
  1. ;-- if HLCA=NE and HLAA=NE set to "sucessful"
  1. I HLCA="NE",HLAA="NE" S RESULT=3 G EXIT
  1. ;-- else set to "awaiting ack"
  1. S RESULT=2
  1. ;
  1. EXIT ;
  1. Q RESULT
  1. ;
  1. DOMAIL(HLLINK) ; This function will determine if the MailMan LLP should
  1. ; be used to x-mit the outgoing message.
  1. ; INPUT - IEN of HL LOGICAL LINK (#870)
  1. ; OUTPUT - 1=Yes, 0=N
  1. ;
  1. N X
  1. S X=$P($G(^HLCS(870,+HLLINK,0)),U,22)
  1. Q $S(X:1,1:0)
  1. ;
  1. ; INPUT - HLINST=Institution name or VISN name or ien
  1. ; If HLFLG="I", institution number is passed
  1. ; If HLFLG="D", HLINST=DOMAIN name or DOMAIN ien
  1. ; If HLFLG="", Institution name or ien is assumed
  1. ; OUTPUT - HLI(LINK IEN)=LINK NAME passed by reference
  1. S HLFLG=$G(HLFLG)
  1. Q:$G(HLINST)']""
  1. N HLP S HLI=0
  1. ;Domain passed
  1. I HLFLG="D" D DOM Q
  1. ;Institution name or number
  1. I HLFLG="I"!('HLINST) D
  1. . ;patch HL*1.6*109
  1. . N X ;to protect the variable from calling routine
  1. . S DIC=4,DIC(0)="MXZ",X=HLINST D ^DIC S HLINST=+Y
  1. . ;patch HL*1.6*109 end
  1. Q:HLINST<1
  1. ;pass institution ien
  1. D CHILDREN^XUAF4("HLP","`"_HLINST) I $D(HLP) D Q
  1. .S HLINST=0 F S HLINST=$O(HLP("C",HLINST)) Q:HLINST<1 D L1
  1. L1 F S HLI=$O(^HLCS(870,"C",HLINST,HLI)) Q:HLI<1 D
  1. .S HLI(HLI)=$P(^HLCS(870,HLI,0),"^")
  1. Q
  1. DOM ;Domain
  1. ;patch HL*1.6*109 start
  1. ;to protect the variable from calling routine
  1. N X
  1. I 'HLINST S DIC=4.2,DIC(0)="MXZ",X=HLINST D ^DIC S HLINST=+Y
  1. ;patch HL*1.6*109 end
  1. ;
  1. Q:HLINST<1
  1. F S HLI=$O(^HLCS(870,"D",HLINST,HLI)) Q:HLI<1 D
  1. .S HLI(HLI)=$P(^HLCS(870,HLI,0),"^")
  1. Q ; patch HL*1.6*109: add "Q" to quit DOM