source: FOIAVistA/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRAOR4.m@ 711

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

initial load of FOIAVistA 6/30/08 version

File size: 3.6 KB
Line 
1GMRAOR4 ;HIRMFO/WAA,FPT-OERR HL7 UTILITY ; 2/9/95
2 ;;4.0;Adverse Reaction Tracking;**4,16**;Oct 10, 2000
3 ;MSG = HL7 Message array
4 ;GMRANODE = IEN of MSG array
5 ;GMRAND = Date from MSG(GMRANODE)
6 ;GMRAMTP = Message type
7EN1(MSG) ; MSG is the array that is passed to ART should be pass by
8 ; reference
9 N GMRANODE,GMRAND,GMRAMTP
10 S GMRANODE=0
11 F S GMRANODE=$O(MSG(GMRANODE)) Q:GMRANODE<1 D
12 .S GMRAND=MSG(GMRANODE),GMRAMTP=$E(GMRAND,1,3)
13 .I "^MSH^PID^PV1^AL1^ZAL^ZAO^ZAS^NTE^"'[("^"_GMRAMTP_"^") S GMRAMTP="ERROR"
14 .D @GMRAMTP
15 .Q
16 K %,DL1,DL2,DL3,DL4,DL4,GMRAI,GMRAID,GMRAIDC,GMRAIDN,GMRAIDO,GMRAIDS,I
17 D EN1^GMRAOR5
18 K GMRADFN,GMRAL
19 Q
20MSH ;Message Header Information
21 ;Set up delimiters DL1-DL5
22 N GMRADL
23 F I=1:1:5 S GMRADL="DL"_I,@GMRADL=$E(GMRAND,(3+I)) ; Assign all delimiters
24 Q
25PID ;Patient Id Information
26 ;GMRADFN = DFN of patient in ^DPT(DFN) Patient (2) file
27 S GMRADFN=$P(GMRAND,DL1,4)
28 Q
29PV1 ;Allergy Information
30 Q
31AL1 ;Allergy informaton
32 ;building GMRAL Array to be used to stuff only new data
33 ;GMRAID=sequence number of allergy
34 ;~=continuation
35 ; Allergy AL1 Segment
36 ; GMRAL(GMRAID)=type^file ien^VA Free text drug^file^OERR entry date^~
37 ; GMRAL(1)="D^5^SHELL FISH^99ALL^2940415.06^~
38 ; ZAL Segment
39 ; GMRAL(GMRAID)=~NKA Status^Originator Pt to 200^Observed/Historical
40 ; GMRAL(1)=~y^1270^o"
41 S GMRAID=$P(GMRAND,DL1,2)
42 S %=$P(GMRAND,DL1,3)
43 S %=$S(%="DA":"D",%="FA":"F",%="MA":"O",%="MC":"O",%="AT":"DFO","^DF^DO^FO^"["^"_%_"^":%,1:"")
44 S GMRAL(GMRAID)=%
45 S %="" F GMRAI=4:1:6 S %=%_U_$P($P(GMRAND,DL1,4),DL2,GMRAI)
46 S GMRAL(GMRAID)=GMRAL(GMRAID)_%
47 S %=$$HL7TFM^XLFDT($P(GMRAND,DL1,7))
48 S GMRAL(GMRAID)=GMRAL(GMRAID)_U_%
49 Q
50ZAL ;Allergy type information
51 S GMRAL(GMRAID)=GMRAL(GMRAID)_U_$S($P(GMRAND,DL1,3)="YES":"n",$P(GMRAND,DL1,3)="NO":"y",1:"")_U_$P(GMRAND,DL1,4)
52 S GMRAL(GMRAID)=GMRAL(GMRAID)_U_$S($P(GMRAND,DL1,5)="OB":"o",$P(GMRAND,DL1,5)="HI":"h",1:"")
53 Q
54ZAO ;Observed allergy information
55 ;GMRAIDO = Sequence #
56 ; ZAO Observed reaction section
57 ; GMRAL(GMRAID,"O",GMRAIDO)=Observed date^Severity^Observer's DUZ
58 ; GMRAL(1,"O",1)="2940401.1^3^1234"
59 ;S GMRAIDO=$P(GMRAND,DL1,2)
60 S GMRAIDO=1
61 S %=$$HL7TFM^XLFDT($P(GMRAND,DL1,3))
62 S GMRAL(GMRAID,"O",GMRAIDO)=%
63 S %=$P(GMRAND,DL1,4)
64 S GMRAL(GMRAID,"O",GMRAIDO)=GMRAL(GMRAID,"O",GMRAIDO)_U_$S(%="MI":1,%="MO":2,%="SV":3,1:"")_U_$P(GMRAND,DL1,5)
65 Q
66ZAS ;Allergy Signs/Symptoms
67 ;GMRAIDS = Sequence #
68 ; ZAS Observed reaction section
69 ; GMRAL(GMRAID,"S",GMRAIDS)=IEN of file^Free Text of entry^File of SS
70 ; ^Date of the SS
71 ; GMRAL(1,"S",1)="32^SEVERE RASH^99ALS^2951211.1120"
72 S GMRAIDS=$P(GMRAND,DL1,2)
73 S GMRAL(GMRAID,"S",GMRAIDS)=$P($P(GMRAND,DL1,3),DL2,4)_U
74 S GMRAL(GMRAID,"S",GMRAIDS)=GMRAL(GMRAID,"S",GMRAIDS)_$P($P(GMRAND,DL1,3),DL2,5)_U
75 S GMRAL(GMRAID,"S",GMRAIDS)=GMRAL(GMRAID,"S",GMRAIDS)_$P($P(GMRAND,DL1,3),DL2,6)_U
76 S %=$P(GMRAND,DL1,4)
77 I %'="" S %=$$HL7TFM^XLFDT($P(GMRAND,DL1,4)),GMRAL(GMRAID,"S",GMRAIDS)=GMRAL(GMRAID,"S",GMRAIDS)_%
78 Q
79NTE ;Comments
80 ;GMRAIDN = Sequence #
81 ;GMRAIDC = the next line of text from the HL7 script
82 ; NTE Comments section
83 ; GMRAL(GMRAID,"N",GMRAIDN)=Source of comments(Originator always)
84 ; GMRAL(1,"N",1)="n"
85 ; GMRAL(1,"N",1,1)=FREE TEXT
86 S GMRAIDN=1
87 ; old Code S GMRAIDN=$P(GMRAND,DL1,2)
88 S GMRAL(GMRAID,"N",GMRAIDN)="O"
89 ; old code S GMRAL(GMRAID,"N",GMRAIDN,1)=$P(GMRAND,DL1,3)
90 S GMRAL(GMRAID,"N",GMRAIDN,1)=$P(GMRAND,DL1,4)
91 ; old code S GMRAIDC="0" F S GMRAIDC=$O(MSG(GMRANODE,GMRAIDC)) Q:GMRAIDC<1 Q:$P(MSG(GMRANODE,GMRAIDC),DL1)'="NTE" D
92 S GMRAIDC="0" F S GMRAIDC=$O(MSG(GMRANODE,GMRAIDC)) Q:GMRAIDC<1 D
93 .S GMRAL(GMRAID,"N",GMRAIDN,GMRAIDC+1)=MSG(GMRANODE,GMRAIDC)
94 .Q
95 Q
96ERROR ;Error handling
97 Q
Note: See TracBrowser for help on using the repository browser.