source: WorldVistAEHR/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRAOR1.m@ 701

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

initial load of WorldVistAEHR

File size: 1.6 KB
Line 
1GMRAOR1 ;HIRMFO/RM,WAA-OERR UTILITIES ;8/2/04 15:13
2 ;;4.0;Adverse Reaction Tracking;**21**;Mar 29, 1996
3EN1(DFN,ARRAY) ; This entry returns a list of patient allergies/adverse
4 ; reactions.
5 ; Input variables:
6 ; DFN = IEN of patient in Patient (2) file
7 ; ARRAY = Return array for Patient reactions.
8 ; If ARRAY="" or undefined default will be GMRARXN.
9 Q:$G(DFN)'>0
10 S ARRAY=$S($G(ARRAY)'="":ARRAY,1:ARRAY="GMRARXN") Q:ARRAY="GMRAL"
11 K GMRARXN,GMRAL,@ARRAY
12 D EN1^GMRADPT ; Get Patient Allergies
13 I GMRAL D ; If the patient has reaction then reprocess to OERR Fmt
14 .N GMRAIEN,GMRADFN,%,GMRASVR
15 .S GMRARXN=1,GMRAIEN=0
16 .F S GMRAIEN=$O(GMRAL(GMRAIEN)) Q:GMRAIEN<1 D
17 ..S GMRARXN(GMRARXN)=$P(GMRAL(GMRAIEN),U,2)_U ; Get freetext of agent.
18 ..; Loop through 120.85 file to find all observed reacting reports for
19 ..; this reaction. Grab severity and store only the highest value.
20 ..S GMRADFN=0,%="",GMRASVR="" F S GMRADFN=$O(^GMR(120.85,"C",GMRAIEN,GMRADFN)) Q:GMRADFN<1 S %=$P($G(^GMR(120.85,GMRADFN,0)),U,14) S:%>+GMRASVR GMRASVR=%
21 ..S GMRARXN(GMRARXN)=GMRARXN(GMRARXN)_$S(GMRASVR=1:"MILD",GMRASVR=2:"MODERATE",GMRASVR=3:"SEVERE",1:"")_U_GMRAIEN
22 ..;Loop through the S/S multiple and get the external format and possibly the date/time.
23 ..S %=0 F S %=$O(GMRAL(GMRAIEN,"S",%)) Q:%<1 S GMRARXN(GMRARXN,"S",%)=$P(GMRAL(GMRAIEN,"S",%),";")_$S($G(GMRAIDT):";"_$P(^GMR(120.8,GMRAIEN,10,$O(^GMR(120.8,GMRAIEN,10,"B",$P(GMRAL(GMRAIEN,"S",%),";",2),0)),0),U,4),1:"") ;21
24 ..S GMRARXN=GMRARXN+1
25 ..Q
26 .S GMRARXN=1
27 .Q
28 E S GMRARXN=GMRAL
29 I ARRAY'="GMRARXN" M @ARRAY=GMRARXN K GMRARXN
30 K GMRAL
31 Q
Note: See TracBrowser for help on using the repository browser.