Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: GMRAEF1

GMRAEF1.m

Go to the documentation of this file.
  1. GMRAEF1 ;HIRMFO/WAA-FDA EXCEPTION REPORT ; 11/25/92
  1. ;;4.0;Adverse Reaction Tracking;;Mar 29, 1996
  1. EN1 ; Entry to PRINT PATIENT FDA EXCEPTION DATA option
  1. K DIC S GMRAOUT=0
  1. W ! S DIC="^DPT(",DIC(0)="AEQM"
  1. D ^DIC K DIC,DLAYGO G:+Y'>0 EN1Q
  1. S GMRDFN=+Y D EN2 G:'GMRAOUT EN1
  1. EN1Q K GMRDFN,DIC,GMRAOUT
  1. D KILL^XUSCLEAN G EXIT
  1. EN2 ;
  1. S GMRAX=$P($G(^GMR(120.86,GMRDFN,0)),U,2) I GMRAX=0 W !,"This patient has No Known Allergies" K GMRAX Q
  1. S X=0 F X=0:0 S X=$O(^GMR(120.8,"B",GMRDFN,X)) Q:X'>0 I '+$G(^GMR(120.8,X,"ER")) S X=X+1 Q
  1. I 'X W !,"This patient has no allergies on file" Q
  1. DDATE ;Select discharge date
  1. K DIR S DIR("A")="Enter the Date to start search (Time optional)"
  1. S DIR("B")="T-30",DIR(0)="DO^::AET"
  1. S DIR("?")="ENTER THE DATE YOU WANT THE SYSTEM TO START IT'S SEARCH"
  1. D ^DIR K DIR
  1. I "^^"[Y S GMRAOUT=1 G EXIT
  1. I $D(DIRUT) G EXIT
  1. S GMRASTDT=Y
  1. S GMRAIEN=0 F S GMRAIEN=$O(^GMR(120.8,"B",GMRDFN,GMRAIEN)) Q:GMRAIEN<1 D
  1. .Q:+$G(^GMR(120.8,GMRAIEN,"ER"))
  1. .S GMRA(0)=$G(^GMR(120.8,GMRAIEN,0))
  1. .Q:GMRA(0)=""
  1. .I $P(GMRA(0),U,6)'="o"!($P(GMRA(0),U,20)'["D") Q
  1. .I '$P(GMRA(0),U,12) Q
  1. .I $P(GMRA(0),U,4)<GMRASTDT Q
  1. .I $$CMPFDA(GMRAIEN) Q
  1. .S GMRABGDT=$P(GMRA(0),U,4)
  1. .S ^TMP($J,"GMRAEF",GMRDFN,GMRABGDT)=GMRAIEN
  1. .Q
  1. D EN1^GMRAEF
  1. Q
  1. CMPFDA(DA) ; GIVEN DA ENTRY IN 120.8 RETURN 0 IF THERE IS INCOMPLETE
  1. ; FDA DATA, ELSE RETURN 1
  1. N X
  1. S X=0,Y=0 ; Pre set quit flag to valid
  1. ;loop through for each entry
  1. F S X=$O(^GMR(120.85,"C",DA,X)) Q:X'>0 D Q:'Y
  1. .S X(0)=$G(^GMR(120.85,X,0)) ; get the zero node
  1. .; Required data
  1. .I $P(X(0),U)="" Q ; Date/Time of Event
  1. .I $P(X(0),U,2)="" Q ; Patient
  1. .I $P(X(0),U,18)="" Q ; Date Reported
  1. .I $P(X(0),U,19)="" Q ; Reporting User
  1. .I '$O(^GMR(120.85,X,2,0)) Q ; Reaction
  1. .I '$O(^GMR(120.85,X,3,0)) Q ; Suspected Agent
  1. .S Y=1
  1. .I $P(X(0),U,3)'="" Q ; Question 1
  1. .I $P(X(0),U,4)'="" Q ; Question 2
  1. .I $P(X(0),U,5)'="" Q ; Question 3
  1. .I $P(X(0),U,6)'="" Q ; Question 4
  1. .I $P(X(0),U,7)'="" Q ; Question 5
  1. .I $P(X(0),U,9)'="" Q ; Question 6
  1. .I $P(X(0),U,10)'="" Q ; Question 7
  1. .I $P(X(0),U,11)'="" Q ; Question 8
  1. .I $P(X(0),U,16)'="" Q ; Question 9
  1. .I $P(X(0),U,17)'="" Q ; Question 10
  1. .S Y=0
  1. .Q
  1. Q Y
  1. EXIT ;EXIT OF ROUTINE
  1. K DIC
  1. Q