| 1 | GMRA2PRE ;HIRMFO/FPT-Pre-init for GMRA*4*2 ;7/24/96  08:43
 | 
|---|
| 2 |  ;;4.0;Adverse Reaction Tracking;**2**;Mar 29, 1996
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 |  ; This pre-init for patch #2 does the following:
 | 
|---|
| 5 |  ; 1) deletes the Soundex cross-reference on File 120.82 Field #.01,
 | 
|---|
| 6 |  ; 2) fixes bad data in File 120.86
 | 
|---|
| 7 |  ;
 | 
|---|
| 8 |  D DEL01,ERR
 | 
|---|
| 9 |  Q
 | 
|---|
| 10 |  ;
 | 
|---|
| 11 | DEL01 ; Delete ^DD(120.8,.01 and ^GMRD(120.8,"SOUND")
 | 
|---|
| 12 |  ; This field will be restored in the installation process without
 | 
|---|
| 13 |  ; the soundex cross-reference
 | 
|---|
| 14 |  S DA=.01,DA(1)=120.82,DIK="^DD(120.82," D ^DIK
 | 
|---|
| 15 |  K ^GMRD(120.82,"SOUND"),DA,DIK
 | 
|---|
| 16 |  Q
 | 
|---|
| 17 | ERR ; Delete patient assessment entry in file 120.86 if second piece is 1
 | 
|---|
| 18 |  ; and there are no active entries (i.e., not entered-in-error) in
 | 
|---|
| 19 |  ; file 120.8 for the patient.
 | 
|---|
| 20 |  ; In File 120.86, fix missing .01 value, delete erroneous 5th piece and
 | 
|---|
| 21 |  ; fix 2nd piece.
 | 
|---|
| 22 |  S GMRALOOP=0
 | 
|---|
| 23 |  F  S GMRALOOP=$O(^GMR(120.86,GMRALOOP)) Q:GMRALOOP'>0  D
 | 
|---|
| 24 |  .S GMRANODE=$G(^GMR(120.86,GMRALOOP,0)) ;get zero node
 | 
|---|
| 25 |  .S GMRAPRA=$P(GMRANODE,U,2) ;pt reaction assessment
 | 
|---|
| 26 |  .I $P(GMRANODE,U,5)]"" S $P(^GMR(120.86,GMRALOOP,0),U,5)="" ;clean out 5th piece
 | 
|---|
| 27 |  .I $P(GMRANODE,U,1)="" S $P(^GMR(120.86,GMRALOOP,0),U,1)=GMRALOOP,DA=GMRALOOP,DIK="^GMR(120.86,",DIK(1)=".01" D EN^DIK K DIK(1) ;put in missing name pointer
 | 
|---|
| 28 |  .I GMRAPRA=1 I $$NKASCR^GMRANKA(GMRALOOP) S DA=GMRALOOP,DIK="^GMR(120.86," D ^DIK W:$E(IOST)="C" "." Q  ;delete 120.86 entries if assessment=1, but nka
 | 
|---|
| 29 |  .I GMRAPRA'=0,GMRAPRA'=1 D  ;look for garbage in pt reaction assessment
 | 
|---|
| 30 |  ..S GMRANKA=$$NKASCR^GMRANKA(GMRALOOP) ;pt has reactions (0) or nka (1)
 | 
|---|
| 31 |  ..I GMRANKA=1 S DA=GMRALOOP,DIK="^GMR(120.86," D ^DIK W:$E(IOST)="C" "." Q  ;delete 120.86 entry if nka
 | 
|---|
| 32 |  ..I GMRANKA=0 S $P(^GMR(120.86,GMRALOOP,0),U,2)=1 ;set pt assessment=1
 | 
|---|
| 33 |  ..Q
 | 
|---|
| 34 |  .Q 
 | 
|---|
| 35 |  K DA,DIK,GMA,GMRALOOP,GMRANKA,GMRANODE,GMRAPRA
 | 
|---|
| 36 |  Q
 | 
|---|