GMRAOR0 ;HIRMFO/WAA,FPT-OERR HL7 UTILITY ; 2/9/95
;;4.0;Adverse Reaction Tracking;**4**;Mar 29, 1996
DUPCHK(DFN,GMRALL) ;CHECK FOR DUPS
;Input variable:
; DFN = Patient DFN
; GMRALL = Free text of allergy
;
;return variable:
; GMRAFLG = (0,1,-1)
; 0 Patient has no matching reactions on file
; 1 Patient has a matching reaction.
; -1 Patient has a matching reaction but is E/E
;
;********************************************************************
N GMRAFLG,GMRAPA
S GMRAFLG=0,GMRAPA=0
;Loop through all the patient's reaction and look for matches
F S GMRAPA=$O(^GMR(120.8,"B",DFN,GMRAPA)) Q:GMRAPA<1 D Q:GMRAFLG=1
.Q:GMRALL'=$P($G(^GMR(120.8,GMRAPA,0)),U,2) ;Not a match
.I +$G(^GMR(120.8,GMRAPA,"ER")) S GMRAFLG=-1 Q ;E/E
.S GMRAFLG=1 ;Matching allergy.
.Q
Q GMRAFLG
GMRAOR0 ;HIRMFO/WAA,FPT-OERR HL7 UTILITY ; 2/9/95
+1 ;;4.0;Adverse Reaction Tracking;**4**;Mar 29, 1996
DUPCHK(DFN,GMRALL) ;CHECK FOR DUPS
+1 ;Input variable:
+2 ; DFN = Patient DFN
+3 ; GMRALL = Free text of allergy
+4 ;
+5 ;return variable:
+6 ; GMRAFLG = (0,1,-1)
+7 ; 0 Patient has no matching reactions on file
+8 ; 1 Patient has a matching reaction.
+9 ; -1 Patient has a matching reaction but is E/E
+10 ;
+11 ;********************************************************************
+12 NEW GMRAFLG,GMRAPA
+13 SET GMRAFLG=0
SET GMRAPA=0
+14 ;Loop through all the patient's reaction and look for matches
+15 FOR
SET GMRAPA=$ORDER(^GMR(120.8,"B",DFN,GMRAPA))
IF GMRAPA<1
QUIT
Begin DoDot:1
+16 ;Not a match
IF GMRALL'=$PIECE($GET(^GMR(120.8,GMRAPA,0)),U,2)
QUIT
+17 ;E/E
IF +$GET(^GMR(120.8,GMRAPA,"ER"))
SET GMRAFLG=-1
QUIT
+18 ;Matching allergy.
SET GMRAFLG=1
+19 QUIT
End DoDot:1
IF GMRAFLG=1
QUIT
+20 QUIT GMRAFLG