| 1 | GMRAPAT ;HIRMFO/WAA-Select a patient for ART System ;10/8/96  15:19 | 
|---|
| 2 | ;;4.0;Adverse Reaction Tracking;**5**;Mar 29, 1996 | 
|---|
| 3 | PAT ;Select a patient from the patient file | 
|---|
| 4 | ;    Return list: | 
|---|
| 5 | ;           DFN = If DFN is null patient DFN from the patient file | 
|---|
| 6 | ; | 
|---|
| 7 | S GMRAOUT=0 | 
|---|
| 8 | W ! S DIC="^DPT(",DIC(0)="AEQM" D ^DIC | 
|---|
| 9 | I +Y'>0 S GMRAOUT=1 Q | 
|---|
| 10 | S DFN=+Y,GMRADOD=$P($G(^DPT(DFN,.35)),U) | 
|---|
| 11 | ;check if patient is deceased | 
|---|
| 12 | I GMRADOD]"" D | 
|---|
| 13 | .W !!?5,$C(7),"NOTE: This patient is deceased (",$$FMTE^XLFDT(GMRADOD),").",!! | 
|---|
| 14 | .D HANGT^GMRAPEH0 | 
|---|
| 15 | .Q | 
|---|
| 16 | K GMRADOD | 
|---|
| 17 | Q | 
|---|
| 18 | REACT(DFN) ;Select a patient reaction | 
|---|
| 19 | ; | 
|---|
| 20 | Q:'$D(DFN) | 
|---|
| 21 | N GMRAL | 
|---|
| 22 | S GMRAOUT=0,GMRAL="" | 
|---|
| 23 | D LIST(DFN,.GMRAL) | 
|---|
| 24 | I GMRAL D EN1^GMRADSP0(.GMRAL) Q:GMRAOUT | 
|---|
| 25 | E  W !?10,"This patient has no allergy/adverse reaction data." | 
|---|
| 26 | Q | 
|---|
| 27 | LIST(DFN,GMRA) ;Get all the reaction for a patient | 
|---|
| 28 | N GMRAPA | 
|---|
| 29 | S (GMRAPA,GMRA)=0 | 
|---|
| 30 | F  S GMRAPA=$O(^GMR(120.8,"B",DFN,GMRAPA)) Q:GMRAPA<1  D | 
|---|
| 31 | .Q:$G(^GMR(120.8,GMRAPA,0))="" | 
|---|
| 32 | .Q:+$G(^GMR(120.8,GMRAPA,"ER")) | 
|---|
| 33 | .D PASS^GMRADPT(GMRAPA,.GMRA) | 
|---|
| 34 | .I 'GMRA S GMRA=1 | 
|---|
| 35 | .Q | 
|---|
| 36 | Q | 
|---|