source: WorldVistAEHR/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRAIAD2.m@ 1087

Last change on this file since 1087 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.8 KB
Line 
1GMRAIAD2 ;BPOIFO/JG - BUILD HL7 ORU^R01 MESSAGE FOR ADVERSE REACTION - PART 2 ; 5 Oct 2005 8:57 AM
2 ;;4.0;Adverse Reaction Tracking;**22,23**;Mar 29, 1996
3 ; Creates HL7 V2.4 ORU^R01 message for allergy adverse reaction
4 ;
5 ; This routine uses the following IAs:
6 ; #4248 - VDEFEL calls (conrolled)
7 ; #3630 - VAFCQRY calls (controlled)
8 ; #2196 - ^PS(50.416,IEN,0) (controlled)
9 ;
10 ; This routine is called as a subroutine by GMRAIAD1
11 ;
12 Q
13 ;
14ENTRY ; Entry point from GMRAIAD1
15 ;
16 ; OBX3 - QUESTIONS 1 thru 10
17OBX3 S Y="",ALRDATA=^GMR(120.85,KEY,0)
18 F I=3:1:7,9:1:11,16,17 S Y=Y_$P(ALRDATA,U,I)_U
19 F I=1:1:10 D
20 . Q:$P(Y,U,I)="" S S=S+1,OUTX=1_HLFS_"CE"_HLFS
21 . S VAL="Q"_I_HLCM_$P($T(QSTNS+(I)),";",3),$P(OUTX,HLFS,3)=VAL
22 . S X=$P(Y,U,I),X=$S(X="y":"Y",X="n":"N",1:""),VAL=X_HLCM
23 . S X=$S(X="Y":"YES",X="N":"NO",1:"")
24 . S VAL=VAL_X_HLCM_"HL70136",$P(OUTX,HLFS,5)=VAL,$P(OUTX,HLFS,11)="F"
25 . S OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
26 ;
27 ; OBX4 - # Days in Hospital
28OBX4 S X=$P(ALRDATA,U,8)+0 G OBX5:X=0
29 S S=S+1,OUTX=1_HLFS_"NM"_HLFS_"DAYS IN HOSPITAL"
30 S $P(OUTX,HLFS,5)=X,$P(OUTX,HLFS,11)="F"
31 S OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
32 ;
33 ; OBX5 - Other related history
34OBX5 S X=$G(^GMR(120.85,KEY,14,1,0)) G OBX6:X=""
35 F I=2:1 S Y=$G(^GMR(120.85,KEY,14,I,0)) Q:Y="" S X=X_" "_Y
36 S S=S+1,OUTX=1_HLFS_"TX"_HLFS_"Other History"_HLFS_HLFS_$$HL7RC^GMRAIAD1(X)
37 S $P(OUTX,HLFS,11)="F",OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
38 ;
39 ; OBX6 - FDA Questions
40OBX6 S PTC=$G(^GMR(120.85,KEY,"PTC1")) G OBX8:PTC=""
41 F I=1:1:5 D
42 . S S=S+1,OUTX=1_HLFS_"CE"_HLFS
43 . S VAL="FDAQ"_I_HLCM_$P($T(FDAQ+I),";",3),$P(OUTX,HLFS,3)=VAL
44 . S VAL=$P(PTC,U,I+(I=5*8)),VAL=VAL_HLCM_$S(VAL="y":"Yes",VAL="n":"No",1:"Unknown")_HLCM_"HL70136"
45 . S $P(OUTX,HLFS,5)=VAL,$P(OUTX,HLFS,11)="F",OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
46 ;
47 ; OBX7 - P & T Questions
48OBX7 F I=1:1:3 D
49 . S S=S+1,OUTX=1_HLFS_"CE"_HLFS,Y=$$HL7RC^GMRAIAD1("P&T")_" ACTION "
50 . S Y=Y_$P("FDA^MFR^RCPM",U,I)_" REPORT",VAL="PTQ"_I_HLCM_Y,$P(OUTX,HLFS,3)=VAL
51 . S VAL=$P(X,U,I+8),VAL=VAL_HLCM_$S(VAL="y":"Yes",VAL="n":"No",1:"Unknown")_HLCM_"HL70136"
52 . S $P(OUTX,HLFS,5)=VAL,$P(OUTX,HLFS,11)="F",OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
53 ;
54 ; OBX8 - P & T Addendum
55OBX8 S PTC=$O(^GMR(120.85,KEY,"PTC2",0)) G OBX9:PTC="" S IEN=0
56 S VAL=$$TS^VDEFEL(^GMR(120.85,KEY,"PTC2",1,0))
57 F S IEN=$O(^GMR(120.85,KEY,"PTC2",1,1,IEN)) Q:IEN="" D
58 . S S=S+1,OUTX=1_HLFS_"TX"_HLFS_$$HL7RC^GMRAIAD1("P&T Addendum")
59 . S $P(OUTX,HLFS,5)=$$HL7RC^GMRAIAD1(^GMR(120.85,KEY,"PTC2",1,1,IEN,0))
60 . S $P(OUTX,HLFS,11)="F",$P(OUTX,HLFS,14)=VAL
61 . S OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
62 ;
63 ; OBX9 - Notification Dates
64OBX9 S VAL=$P(^GMR(120.85,KEY,0),U,12) I VAL'="" D
65 . ;
66 . ; Date MD notified
67 . S VAL=$$TS^VDEFEL(VAL) S S=S+1,OUTX=1_HLFS_"DT"_HLFS_"DATE MD NOTIFIED"
68 . S $P(OUTX,5,HLFS)=VAL,$P(OUTX,11,HLFS)="F"
69 . S OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
70 ;
71 ; Dates reported to FDA, MFR, RCPM, VAERS
72 S PTC=$G(^GMR(120.85,KEY,"PTC1")) G RETURN:PTC=""
73 F I=1:1:5 S VAL=$P(PTC,U,I+4) I VAL'="" D
74 . S VAL=$$TS^VDEFEL(VAL) S S=S+1,OUTX=1_HLFS_"DT"_HLFS_$P($T(RPTXT+I),";",3)
75 . S $P(OUTX,HLFS,5)=VAL,$P(OUTX,HLFS,11)="F"
76 . S OUTX="OBX"_HLFS_OUTX D SAVE^GMRAIAD1
77 ;
78 ; Return to GMRAIAD1
79RETURN Q
80 ;
81QSTNS ; Question 1-10 Set
82 ;;Patient died from reaction?
83 ;;Patient treated with RX drug?
84 ;;Life threatening illness?
85 ;;Required ER/MD visit?
86 ;;Required hospitalization?
87 ;;Prolonged hospitalization?
88 ;;Resulted in permanent disability?
89 ;;Patient recovered?
90 ;;Is this event a congenital anomaly?
91 ;;Did this event require intervention to prevent impairment or damage?
92 ;
93FDAQ ; FDA Questions
94 ;;Serious ADR?
95 ;;ADR related to new drug? (Marketed within last 2 yrs.)
96 ;;Unexpected ADR?
97 ;;ADR related to therapeutic failure?
98 ;;Dose related?
99 ;
100RPTXT ; Dates Reported Texts
101 ;;DATE REPORTED TO FDA
102 ;;DATE OF PATIENT CONSENT TO MFR
103 ;;DATE SENT TO MFR
104 ;;DATE SENT TO RCPM
105 ;;DATE SENT TO VAERS
Note: See TracBrowser for help on using the repository browser.