source: WorldVistAEHR/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRADSP1.m@ 762

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

initial load of WorldVistAEHR

File size: 2.6 KB
Line 
1GMRADSP1 ;HIRMFO/WAA-DISPLAY ALLERGY ;9/6/95 11:06
2 ;;4.0;Adverse Reaction Tracking;;Mar 29, 1996
3DISBLD(IEN,ARRAY) ; This subroutine will bulid the array that will
4 ; be displayed for each reactant. The IEN for each reactant in
5 ; stored in GMRAPA.
6 N CNT,X,NODE
7 S NODE=$G(^GMR(120.8,IEN,0)) Q:NODE="" S CNT=1
8 I $L(GMRANAME)>50 S ARRAY(CNT)=$E(GMRANAME,1,50),CNT=CNT+1,ARRAY(CNT)=$E(GMRANAME,51,999)
9 E S ARRAY(CNT)=GMRANAME
10ING ;Find all the ingredents for a reactant.
11 I $O(^GMR(120.8,IEN,2,0))>0 D
12 .N GMRAFST,GMRAGBAL,GMRAING,GMRAINGR,GMRALLEG,GMRALST
13 .S GMRAINGR=0,GMRALLEG=0
14 .F S GMRAINGR=$O(^GMR(120.8,IEN,2,GMRAINGR)) Q:GMRAINGR'>0 S GMRAGBAL=^GMR(120.8,IEN,2,GMRAINGR,0) D
15 ..Q:$G(^PS(50.416,GMRAGBAL,0))="" ; Didn't find the given ingredent.
16 ..I $P(NODE,U,2)=$P(^PS(50.416,GMRAGBAL,0),U) Q
17 ..S GMRALLEG(IEN,$P(^PS(50.416,GMRAGBAL,0),U))="",GMRALLEG=GMRALLEG+1
18 ..Q
19 .I GMRALLEG S (GMRAINGR,GMRAING)="",CNT=CNT+1,ARRAY(CNT)="",GMRAFST=1,GMRALST=0 F S GMRAINGR=$O(GMRALLEG(IEN,GMRAINGR)) Q:GMRAINGR="" D
20 ..I $O(GMRALLEG(IEN,GMRAINGR))="" S GMRALST=1
21 ..S GMRAING=GMRAINGR
22 ..I GMRAFST S GMRAING=" ("_GMRAING,GMRAFST=0
23 ..I 'GMRALST S GMRAING=GMRAING_", "
24 ..I GMRALST S GMRAING=GMRAING_")"
25 ..I $L(ARRAY(CNT)_GMRAING)>52 S CNT=CNT+1,ARRAY(CNT)=" "_GMRAING
26 ..E S ARRAY(CNT)=ARRAY(CNT)_GMRAING
27 ..Q
28 .Q
29SIGN ;Get all the patient Sign/Symptoms
30 I $O(^GMR(120.8,IEN,10,0))>0 D
31 .N GMRAFST,GMRALST,GMRAOTH,GMRAREAC,GMRAREAN,GMRATONS
32 .S GMRAOTH=$O(^GMRD(120.83,"B","OTHER REACTION",0))
33 .S GMRAFST=1,GMRALST=0,CNT=CNT+1,ARRAY(CNT)=" Reactions:"
34 .S GMRAREAC=0 F S GMRAREAC=$O(^GMR(120.8,IEN,10,GMRAREAC)) Q:GMRAREAC'>0 S GMRAREAN=$P($G(^GMR(120.8,IEN,10,GMRAREAC,0)),U) I GMRAREAN'="" D
35 ..N GMRAREC
36 ..I '$O(^GMR(120.8,IEN,10,GMRAREAC)) S GMRALST=1
37 ..S GMRATONS=$S(GMRAREAN'=GMRAOTH:$P(^GMRD(120.83,GMRAREAN,0),U),1:$P(^GMR(120.8,IEN,10,GMRAREAC,0),U,2))
38 ..S GMRAREC=GMRATONS
39 ..I GMRAFST S GMRAREC=" "_GMRAREC,GMRAFST=0
40 ..I 'GMRALST S GMRAREC=GMRAREC_", "
41 ..I $L(ARRAY(CNT)_GMRAREC)>52 S CNT=CNT+1,ARRAY(CNT)=" "_GMRAREC
42 ..E S ARRAY(CNT)=ARRAY(CNT)_GMRAREC
43 ..Q
44 .Q
45 S %=$S($P(NODE,U,16):"YES",1:" NO") I $P(NODE,U,16),$P(NODE,U,18)="" S %="AUTO"
46 S ARRAY(1)=ARRAY(1)_$J(" ",(53-$L(ARRAY(1))))_%
47 S %=$P(NODE,U,14),%=$S(%="P":"PHARM ",%="A":"ALLERGY",%="U":"UNKNOWN ",1:""),ARRAY(1)=ARRAY(1)_$J(" ",(59-$L(ARRAY(1))))_%
48 S %=$P(NODE,U,6),%=$S(%="o":"OBS",%="h":"HIST",1:""),ARRAY(1)=ARRAY(1)_$J(" ",(68-$L(ARRAY(1))))_%
49TYPE S %="" F X=1:1:($L(GMRATYPE)) D
50 .S %=$P("^FOOD^DRUG^OTHER",U,$F("FDO",$E(GMRATYPE,X)))
51 .S ARRAY(X)=$G(ARRAY(X))
52 .S ARRAY(X)=ARRAY(X)_$J(" ",(74-$L(ARRAY(X))))_%
53 .Q
54 Q
Note: See TracBrowser for help on using the repository browser.