source: FOIAVistA/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMART.m@ 632

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

initial load of FOIAVistA 6/30/08 version

File size: 1.2 KB
Line 
1PXRMART ;SLC/DAN - ART computed finding ;01/11/2005
2 ;;2.0;CLINICAL REMINDERS;;Feb 04, 2005
3ARTCL(DFN,NGET,BDT,EDT,NFOUND,TEST,DATE,DATA,TEXT) ;
4 S TEST=$$UP^XLFSTR(TEST)
5 S NFOUND=0
6 Q:TEST=""!(NGET=0)!("^IN:^DR:^"'[("^"_$E(TEST,1,3)_"^"))
7 N WILD,ITEM,SUB,ING,INGT,TERM
8 S WILD=$S(TEST["*":1,1:0),SUB=$S($E(TEST,1,2)="IN":"API",1:"APC")
9 S TEST=$P(TEST,":",2)
10 I 'WILD S ITEM=$S(SUB="API":+$O(^PS(50.416,"B",TEST,0)),1:TEST) Q:ITEM=0 D GETINFO Q
11 S ITEM=$E(TEST,1,$L($P(TEST,"*")))
12 I SUB="APC" F S ITEM=$O(^GMR(120.8,SUB,DFN,ITEM)) Q:ITEM=""!(ITEM'[($E(TEST,1,$L($P(TEST,"*")))))!(NFOUND=NGET) D GETINFO
13 I SUB="API" S TERM=ITEM,ING=0 F S ING=$O(^GMR(120.8,SUB,DFN,ING)) Q:'+ING S INGT=$P(^PS(50.416,ING,0),U) I $E(INGT,1,$L(TERM))=TERM S ITEM=ING D GETINFO
14 Q
15 ;
16GETINFO ;
17 N GMRAR0,EDATE,IEN
18 S IEN="" F S IEN=$O(^GMR(120.8,SUB,DFN,ITEM,IEN),-1) Q:'+IEN!(NFOUND=NGET) D
19 .S GMRAR0=^GMR(120.8,IEN,0)
20 .S EDATE=$P(GMRAR0,U,4)
21 .Q:EDATE<BDT!(EDATE>EDT)
22 .S NFOUND=NFOUND+1,TEST(NFOUND)=1,DATE(NFOUND)=EDATE
23 .S DATA(NFOUND,"REACTANT")=$P(GMRAR0,U,2)
24 .S TEXT(NFOUND)="Documented reaction "_$S(SUB="API":"that includes the ingredient ",1:"to an agent in class ")_$S(SUB="APC":ITEM,1:$P(^PS(50.416,ITEM,0),U))_", reactant was: "_DATA(NFOUND,"REACTANT")_"."
25 Q
Note: See TracBrowser for help on using the repository browser.