VistA-FOIAVistA/r/ADVERSE_REACTION_TRACKING-G.../GMRAOR7.m

31 lines
1.2 KiB
Mathematica

GMRAOR7 ;HIRMFO/WAA,FPT-OERR HL7 UTILITY ;8/28/03 13:52
;;4.0;Adverse Reaction Tracking;**4,17**;Mar 29, 1996
ADVERSE(GMRAPA,GMRAL) ;Add a Adverse reaction entry to file 120.85
;INPUT
; GMRAPA = the entry in file 120.8 that was added
; GMRAL = The entry in the GMRAL array that is being added
;
N GMRAO,GMRAPA1,X,Y
S GMRAO=0 F S GMRAO=$O(GMRAL(GMRAL,"O",GMRAO)) Q:GMRAO<1 D
.K DD,DO,DIC,DINUM,DLAYGO
.S DIC="^GMR(120.85,",DLAYGO=120.85,DIC(0)="L",X=$P(GMRAL(GMRAL,"O",GMRAO),U)
.D FILE^DICN
.K DD,DO,DIC,DINUM,DLAYGO
.Q:Y=-1 S GMRAPA1=+Y
.N GMRALN
.F Q:$$LOCK^GMRAUTL(120.85,GMRAPA1)
.S GMRALN=^GMR(120.85,GMRAPA1,0)
.S $P(GMRALN,U,2)=GMRADFN
.S $P(GMRALN,U,13)=$P(GMRAL(GMRAL),U,7)
.I $P(GMRAL(GMRAL,"O",GMRAO),U,3)]"" S $P(GMRALN,U,13)=$P(GMRAL(GMRAL,"O",GMRAO),U,3)
.S $P(GMRALN,U,14)=$P(GMRAL(GMRAL,"O",GMRAO),U,2)
.S $P(GMRALN,U,15)=GMRAPA
.S ^GMR(120.85,GMRAPA1,0)=GMRALN
.I $D(GMRAL(GMRAL,"S",1)) D SIGN^GMRAOR6(120.85,GMRAPA1,.GMRAL) ;S/S
.S ^GMR(120.85,GMRAPA1,3,0)="^120.8503^1^1"
.S ^GMR(120.85,GMRAPA1,3,1,0)=$P(GMRAL(GMRAL),U,3)
.K DIK,DA S DIK="^GMR(120.85,",DA=GMRAPA1 D IX^DIK K DIK,DA ;17 changed GMRAPA to GMRAPA1
.D UNLOCK^GMRAUTL(120.85,GMRAPA1)
.Q
Q