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

GMRAIAD2.m

Go to the documentation of this file.
  1. GMRAIAD2 ;BPOIFO/JG - BUILD HL7 ORU^R01 MESSAGE FOR ADVERSE REACTION - PART 2 ; 5 Oct 2005 8:57 AM
  1. ;;4.0;Adverse Reaction Tracking;**22,23**;Mar 29, 1996
  1. ; Creates HL7 V2.4 ORU^R01 message for allergy adverse reaction
  1. ;
  1. ; This routine uses the following IAs:
  1. ; #4248 - VDEFEL calls (conrolled)
  1. ; #3630 - VAFCQRY calls (controlled)
  1. ; #2196 - ^PS(50.416,IEN,0) (controlled)
  1. ;
  1. ; This routine is called as a subroutine by GMRAIAD1
  1. ;
  1. Q
  1. ;
  1. ENTRY ; Entry point from GMRAIAD1
  1. ;
  1. ; OBX3 - QUESTIONS 1 thru 10
  1. OBX3 S Y="",ALRDATA=^GMR(120.85,KEY,0)
  1. F I=3:1:7,9:1:11,16,17 S Y=Y_$P(ALRDATA,U,I)_U
  1. F I=1:1:10 D
  1. . Q:$P(Y,U,I)="" S S=S+1,OUTX=1_HLFS_"CE"_HLFS
  1. . S VAL="Q"_I_HLCM_$P($T(QSTNS+(I)),";",3),$P(OUTX,HLFS,3)=VAL
  1. . S X=$P(Y,U,I),X=$S(X="y":"Y",X="n":"N",1:""),VAL=X_HLCM
  1. . S X=$S(X="Y":"YES",X="N":"NO",1:"")
  1. . S VAL=VAL_X_HLCM_"HL70136",$P(OUTX,HLFS,5)=VAL,$P(OUTX,HLFS,11)="F"
  1. . S OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
  1. ;
  1. ; OBX4 - # Days in Hospital
  1. OBX4 S X=$P(ALRDATA,U,8)+0 G OBX5:X=0
  1. S S=S+1,OUTX=1_HLFS_"NM"_HLFS_"DAYS IN HOSPITAL"
  1. S $P(OUTX,HLFS,5)=X,$P(OUTX,HLFS,11)="F"
  1. S OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
  1. ;
  1. ; OBX5 - Other related history
  1. OBX5 S X=$G(^GMR(120.85,KEY,14,1,0)) G OBX6:X=""
  1. F I=2:1 S Y=$G(^GMR(120.85,KEY,14,I,0)) Q:Y="" S X=X_" "_Y
  1. S S=S+1,OUTX=1_HLFS_"TX"_HLFS_"Other History"_HLFS_HLFS_$$HL7RC^GMRAIAD1(X)
  1. S $P(OUTX,HLFS,11)="F",OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
  1. ;
  1. ; OBX6 - FDA Questions
  1. OBX6 S PTC=$G(^GMR(120.85,KEY,"PTC1")) G OBX8:PTC=""
  1. F I=1:1:5 D
  1. . S S=S+1,OUTX=1_HLFS_"CE"_HLFS
  1. . S VAL="FDAQ"_I_HLCM_$P($T(FDAQ+I),";",3),$P(OUTX,HLFS,3)=VAL
  1. . S VAL=$P(PTC,U,I+(I=5*8)),VAL=VAL_HLCM_$S(VAL="y":"Yes",VAL="n":"No",1:"Unknown")_HLCM_"HL70136"
  1. . S $P(OUTX,HLFS,5)=VAL,$P(OUTX,HLFS,11)="F",OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
  1. ;
  1. ; OBX7 - P & T Questions
  1. OBX7 F I=1:1:3 D
  1. . S S=S+1,OUTX=1_HLFS_"CE"_HLFS,Y=$$HL7RC^GMRAIAD1("P&T")_" ACTION "
  1. . S Y=Y_$P("FDA^MFR^RCPM",U,I)_" REPORT",VAL="PTQ"_I_HLCM_Y,$P(OUTX,HLFS,3)=VAL
  1. . S VAL=$P(X,U,I+8),VAL=VAL_HLCM_$S(VAL="y":"Yes",VAL="n":"No",1:"Unknown")_HLCM_"HL70136"
  1. . S $P(OUTX,HLFS,5)=VAL,$P(OUTX,HLFS,11)="F",OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
  1. ;
  1. ; OBX8 - P & T Addendum
  1. OBX8 S PTC=$O(^GMR(120.85,KEY,"PTC2",0)) G OBX9:PTC="" S IEN=0
  1. S VAL=$$TS^VDEFEL(^GMR(120.85,KEY,"PTC2",1,0))
  1. F S IEN=$O(^GMR(120.85,KEY,"PTC2",1,1,IEN)) Q:IEN="" D
  1. . S S=S+1,OUTX=1_HLFS_"TX"_HLFS_$$HL7RC^GMRAIAD1("P&T Addendum")
  1. . S $P(OUTX,HLFS,5)=$$HL7RC^GMRAIAD1(^GMR(120.85,KEY,"PTC2",1,1,IEN,0))
  1. . S $P(OUTX,HLFS,11)="F",$P(OUTX,HLFS,14)=VAL
  1. . S OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
  1. ;
  1. ; OBX9 - Notification Dates
  1. OBX9 S VAL=$P(^GMR(120.85,KEY,0),U,12) I VAL'="" D
  1. . ;
  1. . ; Date MD notified
  1. . S VAL=$$TS^VDEFEL(VAL) S S=S+1,OUTX=1_HLFS_"DT"_HLFS_"DATE MD NOTIFIED"
  1. . S $P(OUTX,5,HLFS)=VAL,$P(OUTX,11,HLFS)="F"
  1. . S OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
  1. ;
  1. ; Dates reported to FDA, MFR, RCPM, VAERS
  1. S PTC=$G(^GMR(120.85,KEY,"PTC1")) G RETURN:PTC=""
  1. F I=1:1:5 S VAL=$P(PTC,U,I+4) I VAL'="" D
  1. . S VAL=$$TS^VDEFEL(VAL) S S=S+1,OUTX=1_HLFS_"DT"_HLFS_$P($T(RPTXT+I),";",3)
  1. . S $P(OUTX,HLFS,5)=VAL,$P(OUTX,HLFS,11)="F"
  1. . S OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
  1. ;
  1. ; Return to GMRAIAD1
  1. RETURN Q
  1. ;
  1. QSTNS ; Question 1-10 Set
  1. ;;Patient died from reaction?
  1. ;;Patient treated with RX drug?
  1. ;;Life threatening illness?
  1. ;;Required ER/MD visit?
  1. ;;Required hospitalization?
  1. ;;Prolonged hospitalization?
  1. ;;Resulted in permanent disability?
  1. ;;Patient recovered?
  1. ;;Is this event a congenital anomaly?
  1. ;;Did this event require intervention to prevent impairment or damage?
  1. ;
  1. FDAQ ; FDA Questions
  1. ;;Serious ADR?
  1. ;;ADR related to new drug? (Marketed within last 2 yrs.)
  1. ;;Unexpected ADR?
  1. ;;ADR related to therapeutic failure?
  1. ;;Dose related?
  1. ;
  1. RPTXT ; Dates Reported Texts
  1. ;;DATE REPORTED TO FDA
  1. ;;DATE OF PATIENT CONSENT TO MFR
  1. ;;DATE SENT TO MFR
  1. ;;DATE SENT TO RCPM
  1. ;;DATE SENT TO VAERS