| 1 | GMRA5UTL ;HIRMFO/FT-Fix ART database due to GMRA*4*2 bug ;9/13/96  13:11
 | 
|---|
| 2 |  ;;4.0;Adverse Reaction Tracking;**5**;Mar 29, 1996
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 |  ; This routine is part of GMRA*4*5. GMRA*4*2 introduced a bug in
 | 
|---|
| 5 |  ; the routine GMRAPEM0 which caused reactions that should have
 | 
|---|
| 6 |  ; been autoverified from being marked as such.
 | 
|---|
| 7 |  ;
 | 
|---|
| 8 | EN1 ; This routine will:
 | 
|---|
| 9 |  ; 1) Find & display reactions that have not been signed-off between
 | 
|---|
| 10 |  ;    the installation of GMRA*4*2 and GMRA*4*5, and
 | 
|---|
| 11 |  ; 2) Prompt the user to autoverify those reactions which will change
 | 
|---|
| 12 |  ;    the ORIGINATOR SIGN OFF (#15), VERIFIED (#19) and VERIFICATION
 | 
|---|
| 13 |  ;    DATE/TIME (#20) fields in File #120.8 to mimic autoverification.
 | 
|---|
| 14 |  ;
 | 
|---|
| 15 |  ; get patch #2 completion date/time(s)
 | 
|---|
| 16 |  K ^TMP("DILIST",$J),GMRADT D CLEAN^DILF
 | 
|---|
| 17 |  D LIST^DIC(9.7,"",17,"I","","","GMRA*4.0*2","","","","","")
 | 
|---|
| 18 |  I '$D(^TMP("DILIST",$J,"ID")) W !,"GMRA*4.0*2 has not been installed on your system. Done." D KILL Q  ;quit if patch not found in Install file (#9.7)
 | 
|---|
| 19 |  S GMRAIDT=0
 | 
|---|
| 20 |  F  S GMRAIDT=$O(^TMP("DILIST",$J,"ID",GMRAIDT)) Q:GMRAIDT'>0  D
 | 
|---|
| 21 |  .S GMRADT=+$G(^TMP("DILIST",$J,"ID",GMRAIDT,17))
 | 
|---|
| 22 |  .I GMRADT>0 S GMRADT(GMRADT)="" ;array for #2 completion date/times
 | 
|---|
| 23 |  .Q
 | 
|---|
| 24 |  S GMRAIDT=$O(GMRADT("")) ;get earliest #2 completion date/time
 | 
|---|
| 25 |  I GMRAIDT'>0 W !,"It does not appear that GMRA*4.0*2 was installed.",!,"Please contact your IRM Field Office Customer Support Representative." D KILL Q
 | 
|---|
| 26 |  ; get GMRA*4*5 patch completion date/time(s)
 | 
|---|
| 27 |  K ^TMP("DILIST",$J),GMRADT D CLEAN^DILF
 | 
|---|
| 28 |  D LIST^DIC(9.7,"",17,"I","","","GMRA*4.0*5","","","","","")
 | 
|---|
| 29 |  S GMRAENDT=0
 | 
|---|
| 30 |  F  S GMRAENDT=$O(^TMP("DILIST",$J,"ID",GMRAENDT)) Q:GMRAENDT'>0  D
 | 
|---|
| 31 |  .S GMRADT=+$G(^TMP("DILIST",$J,"ID",GMRAENDT,17))
 | 
|---|
| 32 |  .I GMRADT>0 S GMRADT(GMRADT)="" ;array for #5 completion date/times
 | 
|---|
| 33 |  .Q
 | 
|---|
| 34 |  S GMRAENDT=$O(GMRADT("")) ;get earliest #5 completion date/time
 | 
|---|
| 35 |  I GMRAENDT="" S GMRAENDT=$$NOW^XLFDT() ;use current date/time if #5 has no completion date/time ("bullet-proofing").
 | 
|---|
| 36 |  ; display #2 completion date/time
 | 
|---|
| 37 |  W !!,"GMRA*4.0*2 was installed on ",$$FMTE^XLFDT(GMRAIDT,1)
 | 
|---|
| 38 |  ; get/display autoverify parameters
 | 
|---|
| 39 |  W !!,"Your current AUTOVERIFY site parameters are:",!!
 | 
|---|
| 40 |  S (GMRAUTO,GMRASITE)=0
 | 
|---|
| 41 |  F  S GMRASITE=$O(^GMRD(120.84,GMRASITE)) Q:GMRASITE'>0  D
 | 
|---|
| 42 |  .S GMRASITE(0)=$G(^GMRD(120.84,GMRASITE,0)) Q:GMRASITE(0)=""
 | 
|---|
| 43 |  .W !,"           Site Parameter Name: ",$P(GMRASITE(0),U,1)
 | 
|---|
| 44 |  .S X=$P(GMRASITE(0),U,2),GMRAUTO=GMRAUTO+X
 | 
|---|
| 45 |  .W !,"    Autoverify Food/Drug/Other: "
 | 
|---|
| 46 |  .W $S(X=0:"NO AUTOVERIFY",X=1:"AUTOVERIFY DRUG ONLY",X=2:"AUTOVERIFY FOOD ONLY",X=3:"AUTOVERIFY DRUG/FOOD",X=4:"AUTOVERIFY OTHER ONLY",X=5:"AUTOVERIFY DRUG/OTHER",X=6:"AUTOVERIFY FOOD/OTHER",X=7:"AUTOVERIFY ALL",1:"<none specified>")
 | 
|---|
| 47 |  .S X=$P(GMRASITE(0),U,6)
 | 
|---|
| 48 |  .W !,"   Autoverify Logical Operator: ",$S(X="!":"OR",X="&":"AND",1:"<none specified>")
 | 
|---|
| 49 |  .S X=$P(GMRASITE(0),U,3),GMRAUTO=GMRAUTO+X
 | 
|---|
| 50 |  .W !,"Autoverify Observed/Historical: ",$S(X=0:"NO AUTOVERIFY",X=1:"AUTOVERIFY HISTORICAL ONLY",X=2:"AUTOVERIFY OBSERVED ONLY",X=3:"AUTOVERIFY BOTH",1:"<none specified>"),!!
 | 
|---|
| 51 |  K DIR,GMRASITE
 | 
|---|
| 52 |  S DIR(0)="E" D ^DIR K DIR I $D(DIRUT) D KILL Q
 | 
|---|
| 53 |  ; if autoverified is not used at all, ask user if he/she wants to
 | 
|---|
| 54 |  ; continue since there shouldn't be any reactions to correct.
 | 
|---|
| 55 |  I GMRAUTO=0 D  I $D(DIRUT)!(Y=1) D KILL Q
 | 
|---|
| 56 |  .W !!
 | 
|---|
| 57 |  .K DIR S DIR(0)="Y",DIR("A")="Want to stop (Y/N)",DIR("B")="YES"
 | 
|---|
| 58 |  .S DIR("?")="Answer YES to continue or NO to halt."
 | 
|---|
| 59 |  .S DIR("A",1)="Since your site does not autoverify any reactions you can halt now."
 | 
|---|
| 60 |  .D ^DIR K DIR
 | 
|---|
| 61 |  .Q
 | 
|---|
| 62 |  W @IOF
 | 
|---|
| 63 |  S GMRANOW=$$NOW^XLFDT(),(GMRACNT,GMRAIEN)=0 K GMRAOUT
 | 
|---|
| 64 |  ; loop through unsigned reactions
 | 
|---|
| 65 |  F  S GMRAIEN=$O(^GMR(120.8,"ASGN",GMRAIEN)) Q:GMRAIEN'>0  D  Q:$D(GMRAOUT)  ;quit if user up-arrows out
 | 
|---|
| 66 |  .S GMRANODE=$G(^GMR(120.8,+GMRAIEN,0)) Q:GMRANODE=""
 | 
|---|
| 67 |  .I $P(GMRANODE,U,4)]"" D
 | 
|---|
| 68 |  ..S GMRAODT=$P(GMRANODE,U,4) ;origination date/time
 | 
|---|
| 69 |  ..Q:GMRAODT'>GMRAIDT  ;quit if origination date/time before GMRA*4*2 installation
 | 
|---|
| 70 |  ..Q:GMRAODT>GMRAENDT  ;quit if origination date/time after GMRA*4*5 installation
 | 
|---|
| 71 |  ..S GMRACNT=GMRACNT+1
 | 
|---|
| 72 |  ..S DIC="^GMR(120.8,",DA=GMRAIEN K DR D EN^DIQ ;display reaction data
 | 
|---|
| 73 |  ..;prompt user to autoverify reaction
 | 
|---|
| 74 |  ..W !! K DIR S DIR(0)="Y",DIR("A")="Autoverify this reaction (Y/N)"
 | 
|---|
| 75 |  ..S DIR("?")="Answer YES to mark this reaction as autoverified or NO to leave it unchanged."
 | 
|---|
| 76 |  ..S DIR("?",1)="Answering YES will change the ORIGINATOR SIGN OFF and VERIFIED fields to YES"
 | 
|---|
| 77 |  ..S DIR("?",2)="and enter a date/time into the VERIFICATION DATE/TIME field (i.e., this will"
 | 
|---|
| 78 |  ..S DIR("?",3)="mark the record as autoverified)."
 | 
|---|
| 79 |  ..S DIR("?",4)=" "
 | 
|---|
| 80 |  ..S DIR("?",5)="Answering NO will not change the record."
 | 
|---|
| 81 |  ..S DIR("?",6)=" "
 | 
|---|
| 82 |  ..D ^DIR K DIR I $D(DIRUT) S GMRAOUT=1 Q  ;quit if time-out/up-arrow
 | 
|---|
| 83 |  ..;if yes change fields to mimic autoverified
 | 
|---|
| 84 |  ..I Y=1 S DIE="^GMR(120.8,",DA=GMRAIEN,DR="15///1;19///1;20///"_GMRANOW D ^DIE
 | 
|---|
| 85 |  ..Q
 | 
|---|
| 86 |  .Q
 | 
|---|
| 87 |  I GMRACNT=0 W !!,"No unsigned reactions were found for the time period between the",!,"installation of GMRA*4.0*2 and GMRA*4.0*5.",!!
 | 
|---|
| 88 | KILL ; Kill variables
 | 
|---|
| 89 |  K %,DA,DIC,DIE,DIR,DIROUT,DIRUT,DTOUT,DUOUT,DR,GMRACNT,GMRADT,GMRAENDT,GMRAIDT,GMRAIEN,GMRANODE,GMRANOW,GMRAODT,GMRAOUT,GMRAUTO
 | 
|---|
| 90 |  K ^TMP("DILIST",$J) D CLEAN^DILF
 | 
|---|
| 91 |  Q
 | 
|---|