VistA-WorldVistAEHR/r/ADVERSE_REACTION_TRACKING-G.../GMRAOR6.m

31 lines
1.4 KiB
Mathematica

GMRAOR6 ;HIRMFO/WAA-OERR HL7 UTILITY ;10/15/04 10:59
;;4.0;Adverse Reaction Tracking;**17,21**;Mar 29, 1996
; File all allergies Sign/Symptoms
; INPUT
; IEN = The internal entry number for the file entry being modified
; FILE = The file number of the file being modified
; GMRAL = The internal entry number of the GMRAL array being added
;
SIGN(GMRAFILE,GMRAIEN,GMRAL) ; Signs/Symptoms
Q:$G(GMRAIEN)<1
S GMRANODE=$S(GMRAFILE=120.8:10,GMRAFILE=120.85:2,1:0) Q:'GMRANODE
S GMRASN=0 F S GMRASN=$O(GMRAL(GMRAL,"S",GMRASN)) Q:GMRASN<1 D
.Q:$P(GMRAL(GMRAL,"S",GMRASN),U)'>0 ;17 Screen out bad entries
.Q:$O(^GMR(GMRAFILE,GMRAIEN,GMRANODE,"B",$P(GMRAL(GMRAL,"S",GMRASN),U),"")) ;Prevent DUPS
.K DD,DO,DIC,DINUM,DLAYGO
.S DA(1)=GMRAIEN,DIC="^GMR("_GMRAFILE_","_DA(1)_","_GMRANODE_","
.S DIC(0)="L",X=$P(GMRAL(GMRAL,"S",GMRASN),U),DLAYGO=GMRAFILE
.S DIC("P")=$S(GMRANODE=10:"120.81P",1:"120.8502P")
.D FILE^DICN
.K DD,DO,DIC,DINUM,DLAYGO
.S GMRASN=$P(+Y,U)
.S GMRALN=^GMR(GMRAFILE,GMRAIEN,GMRANODE,GMRASN,0) Q:GMRALN=""
.I '$D(GMRAOTH) S GMRAOTH=$O(^GMRD(120.83,"B","OTHER REACTION",0))
.S $P(GMRALN,U,3)=$P(GMRAL(GMRAL),U,7)
.I $P(GMRALN,U)=GMRAOTH S $P(GMRALN,U,2)=$P(GMRAL(GMRAL,"S",GMRASN),U,2) ;21
.I GMRANODE=10 S $P(GMRALN,U,4)=$P(GMRAL(GMRAL,"S",GMRASN),U,4)
.S ^GMR(GMRAFILE,GMRAIEN,GMRANODE,GMRASN,0)=GMRALN
.Q
K GMRAIEN,GMRANODE,GMRAFILE,GMRASN,GMRALN,GMRAOTH,Y,X
Q